Myers75602
New member
- Joined
- May 30, 2006
- Messages
- 2
- Programming Experience
- Beginner
I have a textbox that handles user input. In order to trap for only a full value (signified by the user pressing enter), I have done:
PrivateSub TextBox1_KeyPress(ByVal sender AsObject, ByVal e As _System.Windows.Forms.KeyPressEventArgs) Handles TextBox1.KeyPress
If e.KeyChar = vbCr Then
...
EndIf
EndSub
That works!
I also allow the user to click a TextBox2 and a value should automatically be filled into the textbox followed by a simulated keypress {ENTER}. I can change TextBox1.Text = "25" but then I have to:
Call TextBox1_KeyPress(TextBox2, vbCr)
-The vbCr part is not working.
I used to be able (in VB6) to:
TextBox1.Text = "25"
Call TextBox1_KeyPress(13)
This is my very first project in VB.net so go easy on me! Is there a better way to do this?
-Myers-
PrivateSub TextBox1_KeyPress(ByVal sender AsObject, ByVal e As _System.Windows.Forms.KeyPressEventArgs) Handles TextBox1.KeyPress
If e.KeyChar = vbCr Then
...
EndIf
EndSub
That works!
I also allow the user to click a TextBox2 and a value should automatically be filled into the textbox followed by a simulated keypress {ENTER}. I can change TextBox1.Text = "25" but then I have to:
Call TextBox1_KeyPress(TextBox2, vbCr)
-The vbCr part is not working.
I used to be able (in VB6) to:
TextBox1.Text = "25"
Call TextBox1_KeyPress(13)
This is my very first project in VB.net so go easy on me! Is there a better way to do this?
-Myers-
Last edited: