|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
how to trap/detect when entering textbox via tabkey?Hello,
I need to trap/detect when a textbox is entered via the tabkey. If the textbox is not empty when entered via the tabkey then set focus to next textbox. To enter that textbox would then require a mouseclick if it already contains text to be edited. I am guessing that I would need to trap for this in the Enter Event of this particular textbox. I tried this in the Enter Event of the Textbox, but... if ctype(sender,KeyValuePair(Of, " ")) obviously not working. I would be very grateful if someone could share how to trap/detect when entering a textbox via the tabkey. Thanks, Rich check out the textbox's GotFocus event. that is fired whenever the control
gets the focus, be it by the mouse or tab key, etc -- -iwdu15 Well, I came up with this
Private Sub txtM_KeyUp(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles txtM.KeyUp If e.KeyCode.ToString.Equals("Tab") Then If txtM.Text <> "" Then txtlastName.Focus() End If End Sub Interestingly, it was the KeyUp event of the textbox where you can trap for the tab key. Anyway, this seems to do what I want. Any other suggestions appreciated. Show quoteHide quote "Rich" wrote: > Hello, > > I need to trap/detect when a textbox is entered via the tabkey. If the > textbox is not empty when entered via the tabkey then set focus to next > textbox. To enter that textbox would then require a mouseclick if it already > contains text to be edited. I am guessing that I would need to trap for > this in the Enter Event of this particular textbox. > > I tried this in the Enter Event of the Textbox, but... > > if ctype(sender,KeyValuePair(Of, " ")) > > obviously not working. I would be very grateful if someone could share how > to trap/detect when entering a textbox via the tabkey. > > Thanks, > Rich
Date Sort
Startup speed Urgent! Get rowindex - datagrid navigation Sharing Class Data With Multiple Forms Difference between MyBase and Me Limit bandwith of my application VB Net 2005 and Email! Need to capture all keystrokes to my application combobox view display width question Images in a Windows DataGrid |
|||||||||||||||||||||||