Click here to Skip to main content
15,901,853 members
Please Sign up or sign in to vote.
2.00/5 (4 votes)
See more:
I write something in textbox and when enter key is pressed a msgbox appear.Can u give me source code.
Posted

There are events for keypress and keydown for textboxes.
In your keydown-event check whether e.keycode is enter-key and if that is the case, then show your messagebox.

And actually learn VB.NET since this is real basic stuff.
 
Share this answer
 
v2
Comments
Neeil 4-Nov-10 2:24am    
thanx man.
in KeyDown event of textbox copy following code..! :-O :laugh:

VB
Private Sub TextBox1_KeyDown(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles TextBox1.KeyDown
        If (e.KeyCode = Keys.Enter) Then
            MsgBox("Enter key pressed")
        End If
End Sub
 
Share this answer
 
Comments
Neeil 4-Nov-10 2:24am    
thank u.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900