#1
  1. No Profile Picture
    Registered User
    ASP Explorer (0 - 99 posts)

    Join Date
    Jul 2006
    Posts
    8
    Rep Power
    0

    Jumping to the next line in VB code


    hello,

    okay, simple question. How in visual basic code do you tell the prompt to go to the next line in the same control on a form? In other words, how do you mimic the behavior of the enter key in code?

    D
  2. #2
  3. Contributing User
    ASP Good Citizen (1000 - 1499 posts)

    Join Date
    Oct 2005
    Location
    @ 8300' in the Colorado Rocky Mountains
    Posts
    1,008
    Rep Power
    162
    You can change the behavior of the Enter key on the "Other" tab of the properties sheet for the control or just hold down the <Ctrl> key while using the Enter hey.
  4. #3
  5. No Profile Picture
    Registered User
    ASP Explorer (0 - 99 posts)

    Join Date
    Jul 2006
    Posts
    8
    Rep Power
    0
    Thanks. However, how do you write that function in code?
  6. #4
  7. Contributing User
    ASP High Scholar (3500 - 3999 posts)

    Join Date
    Mar 2006
    Location
    South Wales
    Posts
    3,674
    Rep Power
    2043
    Hi,

    I'm not sure I understand!! Do you want to insert an "Enter" character in a control such as a textbox?? If so, try the vbCrLf (Carriage Return Line Feed) character:
    Code:
    Text1.Text = "This is one line" & vbCrLf & "and this is on the next"
  8. #5
  9. Contributing User
    ASP High Scholar (3500 - 3999 posts)

    Join Date
    Mar 2006
    Location
    South Wales
    Posts
    3,674
    Rep Power
    2043
    Sorry, that wasn't what you wanted, to do what RuralGuy syggested using code you just have to put the following in the Forms Load event:
    Code:
    Text4.EnterKeyBehavior = True
    changing text4 to the name of your control
  10. #6
  11. No Profile Picture
    Registered User
    ASP Explorer (0 - 99 posts)

    Join Date
    Jul 2006
    Posts
    8
    Rep Power
    0
    hehe, thanks... however, that's not what i was intending to ask. Sorry about that. Let me put it another way. How do you insert text into a control? Say there are 3 controls in which a user inputs data and I want one textbox to display all 3 of these controls. I want it so that each time one of these controls is filled out by the user, the textbox automatically updates and displays the data.
    So, for examples:
    Control 1: 1, Control 2: <blank>, Control 3: <blank>
    Textbox:
    1

    Control 1: 1, Control 2: 2, Control 3: <blank>
    Textbox:
    1
    2

    Control 1: 1, Control 2: 2, Control 3: 3
    Textbox:
    1
    2
    3

    Please notice how the controls are all listed on different lines in the textbox. How would I do/code this? I've already established in the AfterUpdate event of the controls: Me!Textbox = Me!Control1 & " " & Me!Control2 & " " & Me!Control3
    But, that doesn't give me the formatting I'm looking for. Thanks to anyone who can/try to answer this!

    D
  12. #7
  13. Contributing User
    ASP Good Citizen (1000 - 1499 posts)

    Join Date
    Oct 2005
    Location
    @ 8300' in the Colorado Rocky Mountains
    Posts
    1,008
    Rep Power
    162
    Sync or Swim supplied the answer in his/her 1st post.
    Me!Textbox = Me!Control1 & vbCrLf & Me!Control2 & vbCrLf & Me!Control3
  14. #8
  15. No Profile Picture
    Registered User
    ASP Explorer (0 - 99 posts)

    Join Date
    Jul 2006
    Posts
    8
    Rep Power
    0
    AHHH DUH! Sorry, overlooked. Feel like an idiot. Thanks a lot!!! =)

Similar Threads

  1. How can I run VB code when I open the EXE
    By msprenz in forum .NET Development
    Replies: 3
    Last Post: May 5th, 2006, 09:36 AM
  2. Can vb code be fetched from ocx file
    By hithere in forum Visual Basic Programming
    Replies: 3
    Last Post: April 20th, 2006, 01:03 PM
  3. Error message :Line 1: Incorrect syntax near '='.
    By Gracey82 in forum .NET Development
    Replies: 6
    Last Post: March 3rd, 2005, 08:20 AM
  4. Jump to a Line of Code (Goto)
    By riggz in forum ASP Development
    Replies: 2
    Last Post: August 3rd, 2004, 12:04 PM
  5. DataGrid VB code to C#
    By stephensent in forum .NET Development
    Replies: 5
    Last Post: July 8th, 2004, 09:16 AM

IMN logo majestic logo threadwatch logo seochat tools logo