Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

Basic VB question

Options
  • 18-10-2006 1:30pm
    #1
    Closed Accounts Posts: 29,930 ✭✭✭✭


    I am making an extremely basic program in visual basic. I am a total beginner. I have a text box with

    let text1.text = "blah blah blah blah" etc.

    Now the only problem is, I have a narrow text box on my form - how do I get the text to stick within the box rather then have it going on a single line all the way across the first line of the text box that you have to scroll across to see?

    Any help appreciated. I'm sure its something that'd take all of 1 second to find...


Comments

  • Registered Users Posts: 43,913 ✭✭✭✭Basq


    Not fully sure what you mean but try setting the "Multiline" property to true.

    It should wrap the text on the line.


  • Registered Users Posts: 8,022 ✭✭✭youcancallmeal


    Do you want to post a screenshot to make it clearer what were lookin at?


  • Closed Accounts Posts: 29,930 ✭✭✭✭TerrorFirmer


    basquille - you're the man. :D

    Sorry i wasn't a little clearer. :o


  • Registered Users Posts: 43,913 ✭✭✭✭Basq


    Was unsure if you meant you wanted it Multiline (to wrap text onto the next line as it gets longer) or if you actually wanted to force a string onto a new line via "\r\n" but glad you got it sorted.


  • Closed Accounts Posts: 29,930 ✭✭✭✭TerrorFirmer


    Its actually forcing the string onto the next line I want - can you put an example up using the necessary code? Sorry about this, and thanks. First day using VB today and I think I'm doing relatively ok :D


  • Advertisement
  • Closed Accounts Posts: 3,357 ✭✭✭Beano


    If you want to force it on to the next line your string needs a carriage return\line feed character in it at the point you want it to break, just like basquille said. So if you have a multiline textbox and your string is "This is the first line " & vbcrlf & " this is the second line" it will wrap to the second line after "first line"


  • Registered Users Posts: 43,913 ✭✭✭✭Basq


    Think Beano has got it there. Forgot all about the vbCrLf. It's been ages since i done VB so i was gonna suggest:

    [PHP]Text1.Text = "This is the first line!\r\n This is the second line! \r\nThis is the third line!"[/PHP]

    But that wouldn't have worked. Shows what 4 years of Java and C# does to you.

    Keep at it anyways!


  • Closed Accounts Posts: 29,930 ✭✭✭✭TerrorFirmer


    Great stuff - thanks a million guys. :)


  • Closed Accounts Posts: 29,930 ✭✭✭✭TerrorFirmer


    Thanks again lads. Made my first ever program with VB today, not great given I've just started but it ain't too bad either. I'll pick up all of the advanced stuff as I go along.

    Gibbon_war_v1[1].0.Exe.Zip by Bigupload.Com

    Its stupid, and you wouldnt get it unless you were either me or my childish friend. :D

    Anyway thanks lads, very much appreciate the help.


  • Registered Users Posts: 43,913 ✭✭✭✭Basq


    Very good work, HavoK.. it's not stupid at all. With it, you have mastered the basics. Writing to text boxes, performing action events on buttons etc.

    We all had to start somewhere.. definitely keep at it anyways!

    Three tutorials covering the basics here.. i recommend giving writing to and reading from a text file a go next. Quite easy but it can be very powerful.. and you wouldn't believe how often you'd use it.

    I do this 37.5 hours a week for a career so i promote it anyway i can.

    PS - love the gibbon mouse cursor - nifty! :D


  • Advertisement
Advertisement