Saturday, March 31, 2012

Text box enter

How do I assign a sub to a textbox for when the user hits enter whilst the cusor is still within that textbox?I think you mean how can you execute some code when the textbox is submitted (essentially as event handler). Design your textbox in vs.net...then just double click the textbox and the sub is automatically created for you...then all you have to do is fill in your code.
Hi,

I think you are referring about handling the event for the enter key right?

In your code behind, you will find the handle event for the button click as below:-

Private Sub button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles button1.Click

End Sub

you need to add the textbox's text changed event to it as below:-

Private Sub button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles button1.Click, TextBox1.TextChanged

End Sub

This should help you.

Thanks.
Many thanks
your welcome!

did that work for you?

thanks.

0 comments:

Post a Comment