When I set any textbox to multiline as true , and I use keypress event(I used here Enter key) to move to next control , all the text I wrote there go away , that's only happens while multiline property is on !
Printable View
When I set any textbox to multiline as true , and I use keypress event(I used here Enter key) to move to next control , all the text I wrote there go away , that's only happens while multiline property is on !
Not sure what you did, but this is what I did (and it works fine):
Code:Private Sub TextBox1_KeyPress(ByVal sender As Object, _
ByVal e As System.Windows.Forms.KeyPressEventArgs) _
Handles TextBox1.KeyPress
If e.KeyChar = Microsoft.VisualBasic.ChrW(Keys.Enter) Then
Me.SelectNextControl(TextBox1, True, True, False, True)
End If
End Sub
No , the problem is still there . I have multiple textboxes in panel, when I used your code , it moves focus to outside the panel to commandbutton . anyways , it's not a big deal . I reset those textboxes to onelined .
Just wondering if this sort of new bug ?:rolleyes:
I don't see why you're having this problem, the below works for me whether in a panel or out of one:
Note that for forms with nested controls (e.g. in a panel) you need to set that parameter to True...Code:Private Sub TextBox1_KeyPress(ByVal sender As System.Object, _
ByVal e As System.Windows.Forms.KeyPressEventArgs) _
Handles TextBox1.KeyPress, TextBox2.KeyPress, TextBox3.KeyPress, _
TextBox4.KeyPress, TextBox5.KeyPress, TextBox6.KeyPress
If e.KeyChar = Microsoft.VisualBasic.ChrW(Keys.Enter) Then
Me.SelectNextControl(sender, True, True, True, True)
End If
End Sub
Never mind , I firgured it out myself . thanx for the reply though !