When the user presses enter on the menu form that key stroke gets passed through to the form being run when ShowDialog executes. ![]() As a result the focus on the form being run moves from the first control on the form where is should be to the second control in the tab if you use Tab exclusively for navigation this presents no problem as the enter key is just consumed and nothing happensīut the forms I have to create allow navigation by the enter key or tab, IOW, Enter moves to the next field on the form. but I find it hard to beleive that one, the key stroke gets passed to the called form and two, that there does not seem to be a way to prevent it (not that one should have too, I know I can deal with this in the called form with a flag, etc. The textbox is a class that I drop onto the menu form as needed. ' ExitOption is true so check OptionExecute to see if we are returning Private Sub TextBoxNoMouse_KeyPress(ByVal sender As Object, _īyVal e As ) Handles Me.KeyPress It has custom properties to determine if it is and exit button that closes the menu, what form to run when enter is pressed and to manage arrow key navigation. ' OptionExecute is not empty so it should have the name of previous form or menu ' If OptionExecute is empty assume we are at the top level menu and the user wants ' to the previous menu or exiting the application. ![]() 'close this menu form and return to passed formĭim ActiveForm1 As Form = CType(Activator.CreateInstance((frm1)), Form) ' and the user wants to return to that menu form to select a different option. ![]() ' ActiveForm1 is still available to read any values needed so put code here. ' Exitoption is false and optionExecute has a form name so try andĪctiveForm1 = CType(Activator.CreateInstance((frm1)), Form) Keyup enter code#
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |