Notices

Great community. Great ideas.

Welcome to ASP/Free, a community dedicated to helping beginners and professionals alike in improving their knowledge of Microsoft's development and administration technologies. Sign up today to gain access to the combined insight of tens of thousands of members.

Thread: Jumping to the next line in VB code

Results 1 to 8 of 8
Share This Thread →
  1. #1
    planearium is offline Registered User
    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
    RuralGuy's Avatar
    RuralGuy is offline Contributing User
    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.

  3. #3
    planearium is offline Registered User
    Join Date
    Jul 2006
    Posts
    8
    Rep Power
    0
    Thanks. However, how do you write that function in code?

  4. #4
    sync_or_swim's Avatar
    sync_or_swim is offline Contributing User
    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"

  5. #5
    sync_or_swim's Avatar
    sync_or_swim is offline Contributing User
    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

  6. #6
    planearium is offline Registered User
    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

  7. #7
    RuralGuy's Avatar
    RuralGuy is offline Contributing User
    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

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

Share This Thread →

Become Part of This Conversation

Join NowFor Free!

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

ASP Free Advertisers and Affiliates