Hi,
I've got my own custom TextBox control, wich inherits from System.Windows.Forms.TextBox. I've overrided OnKeyDown method, because I want to select the previous or next control if the user press either up or down keys.
Protected Overrides Sub OnKeyDown(ByVal e As System.Windows.Forms.KeyEventArgs)
MyBase.OnKeyDown(e)
If e.KeyCode = Keys.Up Then
If Not Multiline Then
Me.FindForm().SelectNextControl(Me, False, True, True, True)
Else
'TODO: If the current line is the first one, select the previous control
End If
ElseIf e.KeyCode = Keys.Down Then
If Not Multiline Then
Me.FindForm().SelectNextControl(Me, True, True, True, True)
Else
'TODO: If the current line is the last one, select the next control
End If
End If
End Sub
In a multiline textbox, what is the better way to know if I'm in the first or last line?
Thanks very much