Error:As soon as you enter the enter key, a new winform appears

Error:As soon as you enter the enter key, a new winform appears

2208571753
Enthusiast Enthusiast
429 Views
2 Replies
Message 1 of 3

Error:As soon as you enter the enter key, a new winform appears

2208571753
Enthusiast
Enthusiast

When i enter the enter key,a new winform appears,but i didn't write these codes.

 

My code :

Private WithEvents ButtonLogin As ButtonDefinition

ButtonLogin = controlDefs.AddButtonDefinition("Login",
"ButtonLogin",
CommandTypesEnum.kShapeEditCmdType,
AddInClientID,
"Login",
"Login",
smallIcon,
largeIcon)

 

Private Sub ButtonLogin_OnExecute(Context As NameValueMap) Handles ButtonLogin.OnExecute
Dim f1 As New FormLogin
f1.Show()
End Sub

 

When enter the enter key in FormLogin windows,a new FormLogin appears,just like the screenshot below.

20220615084603.png

Why is this happening?

Accepted solutions (1)
430 Views
2 Replies
Replies (2)
Message 2 of 3

Michael.Navara
Advisor
Advisor
Accepted solution

In my opinion when you use f1.Show(), the code continues (exit the method). And when you press enter, Inventor repeats the last command -> show new form.

Try to change the call to f1.ShowDialog(). This wait until the form is closed.

Message 3 of 3

2208571753
Enthusiast
Enthusiast
thanks for your help!
0 Likes