[Newb] KeyPress question

  • Thread starter Thread starter Adriano
  • Start date Start date
A

Adriano

hello,

I have TextBox1 and TextBox2 in my win. app, is it possibe to make my "Left
Arrow Key" act like "Shift Tab"(focus the previous control) only in the case
the cursor comes to the begining of the text inside the textbox??? (sort of
MsWord table behaviour)

thanks in advance,

Adriano
 
Hello,

place two textboxes on form and copy paste this code then type some text in
the second textbox and press the left key a couple of times

<<<<<<<code>>>>>>>>

Private Sub TextBox2_KeyDown(ByVal sender As Object, ByVal e As _
System.Windows.Forms.KeyEventArgs) Handles TextBox2.KeyDown
If e.KeyCode = Keys.Left Then
If TextBox2.SelectionStart = 0 Then
TextBox1.Focus()
End If
End If
End Sub

<<<<<<<<<code>>>>>>>>

hth Peter
 
Many thanks Peter!!!

Regards,
Adriano


Peter Proost said:
Hello,

place two textboxes on form and copy paste this code then type some text in
the second textbox and press the left key a couple of times

<<<<<<<code>>>>>>>>

Private Sub TextBox2_KeyDown(ByVal sender As Object, ByVal e As _
System.Windows.Forms.KeyEventArgs) Handles TextBox2.KeyDown
If e.KeyCode = Keys.Left Then
If TextBox2.SelectionStart = 0 Then
TextBox1.Focus()
End If
End If
End Sub

<<<<<<<<<code>>>>>>>>

hth Peter
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top