0
votes

Forgive me if this is not possible, here's the scenario.

I have 2 textboxes, I type something on textbox1 and press enter, the text goes to textbox2 and the program presses the enter key on textbox2(user will not press the enter key).

Here's what I have in textbox1_keydown

if e.keycode = keys.enter then
  str = textbox1.text
  textbox2.focus()
  textbox2.text = str
  'Make textbox2 press the enter key here, without user pressing it on keyboard
end if
2
The second enter press is to go to the next line in textbox2?γηράσκω δ' αεί πολλά διδασκόμε
Is this a Windows Forms program?John Saunders
Don't edit the question to include your solution... create an answer to your question (yes, you can answer your own question).The_Black_Smurf

2 Answers

1
votes

Found the answer

if e.keycode = keys.enter then
  str = textbox1.text
  textbox2.focus()
  textbox2.text = str
  'Make textbox2 press the enter key here, without user pressing it on keyboard
  SendKeys.Send("{ENTER}")
end if
0
votes
  If e.keycode = Keys.Enter Then
          '/* Check whether textbox1 is empty or not */
       If textbox1.text <> "" Then
          textbox2.text = ""
          textbox2.text = textbox1.text
          SendKeys.Send("{ENTER}")
       Else
         '/* if textbox1 is empty then cursor focus on textbox1 only */
          textbox1.focus()
       End If
   End If

OR

    If e.keycode = Keys.Enter Then
         textbox2.text = ""
         textbox2.text = textbox1.text
         SendKeys.Send("{ENTER}")
    End If