Results 1 to 2 of 2

Thread: Multiline Textbox

  1. #1

    Thread Starter
    Member
    Join Date
    Mar 2000
    Posts
    55

    Unhappy

    In my application there is on form which contains controls
    including one multiline textbox and a command button for witch the 'Default' property is set to True.

    If in the textbox if want type the next line the focus is shifting to command button and its click event is fired.

    if i want to type next line in the textbox i have to press CTRL+Enter.

    How can i avoid this

    Thanks in advance.
    Madhusudana Gorthi [email protected]
    Senior Software Engineer
    www.stgil.com

  2. #2
    Addicted Member
    Join Date
    Jan 1999
    Posts
    239
    Do you have the Form's Keypress event set to "True" and
    are you using the following?

    Private Sub Form_KeyPress(KeyAscii As Integer)
    'Set the Form's KeyPreview to True.
    If KeyAscii = vbKeyReturn Then
    KeyAscii = 0
    SendKeys "{TAB}"
    End If
    End Sub

    The above will enable the enter Key in lieu of Tab for
    every item on the Form. If you start a new project with
    just a TextBox (Multiline Property set to true) and add
    a Command Button without the above then the Enter Key will
    work correctly. You would have to set the Form's Keypress event to "False" and incorporate the above code into the
    individual controls' keypress events to eliminate your problem.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width