Pressing Enter on a textbox
-
Hello, I'm sorry for asking such a basic question but I cannot find the answer to it by searching any forums.. All I need is to be able to do something simple like make a msbgox pop up when the user clicks enter on a text box. Basically a user will type a number in the textbox and then a pop up box will appear showing the number they have just typed. Could someone help me with this please? Thanks John C
-
Hello, I'm sorry for asking such a basic question but I cannot find the answer to it by searching any forums.. All I need is to be able to do something simple like make a msbgox pop up when the user clicks enter on a text box. Basically a user will type a number in the textbox and then a pop up box will appear showing the number they have just typed. Could someone help me with this please? Thanks John C
There are several possible ways to do this, depending on your needs. You could use the "Leave" event of the textbox to popup your messagebox when the control loses focus (either by pressing enter, tab, or clicking the mouse on another control). If you only want the popup to occur when the enter key is pressed, you should use the textbox control's "Keypress" event to check whether the key pressed was the return key, and run your popup code if it was. Hope this helps.
-
Hello, I'm sorry for asking such a basic question but I cannot find the answer to it by searching any forums.. All I need is to be able to do something simple like make a msbgox pop up when the user clicks enter on a text box. Basically a user will type a number in the textbox and then a pop up box will appear showing the number they have just typed. Could someone help me with this please? Thanks John C
Hi, I think the following code will fulfill your requirement. TextBox1_KeyPress ----------------- If Asc(e.KeyChar) = 13 Then MsgBox("The Data You Have Entered : " & TextBox1.Text, MsgBoxStyle.Information) End If With Regards, Pandian S