Hello everyone, im trying to add a few features to a program I am working on, and I think I need some help. I have a textbox (call it textbox1) where the user enters text, and then clicks a button to run the script. What I am trying to do, is once the user clicks in the text box to type the info, I want the button (call it Button1) to be highlighted so they can just hit enter after they input the information. How would I go about this in VB.net?
TL;DR
Have a textbox and button in VB.net. When the user clicks into the textbox I want the button to become highlighted so the user only has to press enter to activate it.
Thank you,
Sebastian
EDIT - Here is the final code in case someone else needs this info later on, nettb is the textbox, netuserbut is the button I am using.
TL;DR
Have a textbox and button in VB.net. When the user clicks into the textbox I want the button to become highlighted so the user only has to press enter to activate it.
Thank you,
Sebastian
EDIT - Here is the final code in case someone else needs this info later on, nettb is the textbox, netuserbut is the button I am using.
Code:
Private Sub nettb_PreviewKeyDown(sender As Object, e As PreviewKeyDownEventArgs) Handles nettb.PreviewKeyDown
If e.KeyCode = Keys.Enter Then
netuserbut.PerformClick()
End If
End Sub
Last edited: