Jump to content

Welcome to Geeks to Go - Register now for FREE

Geeks To Go is a helpful hub, where thousands of volunteer geeks quickly serve friendly answers and support. Check out the forums and get free advice from the experts. Register now to gain access to all of our features, it's FREE and only takes one minute. Once registered and logged in, you will be able to create topics, post replies to existing threads, give reputation to your fellow members, get your own private messenger, post status updates, manage your profile and so much more.

Create Account How it Works
Photo

New Line in Textbox [VB6]


  • Please log in to reply

#1
MaverickSidewinder

MaverickSidewinder

    Member

  • Member
  • PipPipPip
  • 257 posts
Hi, im back with a new question :)

Basically i would like to know how to create a new line on a text box...i know this might sound confusing, but ill explain myself the best i can...

What im actually trying to do is this: With cmd1_Click() i want to get the text from Text1.Text and Text2.Text and put that information on Text3.Text...but here's the problem: the Text1.Text has to be on the first line, the Text2.Text on the second... :)

I've tried this:

Private Sub cmd1_Click()
Dim X As String
Dim Y As String
X = Text1.Text
Y = Text2.Text
Text3.Text = "Sup " & X & " and welcome!" & Chr(13) & Chr(10) & Y & " hello again!"
End Sub

Obviously this isn't the program i am creating, but i just simplified it...:woot:

(The Chr(13) and Chr(10) don't work, they leave a little || thing on the textbox...and searching through google i read a description which said: Its not possible to create a new line on a textbox...unfortunately the page was missing so i couldn't read it thouroughly.)

thank you and ill be waiting patiently for an answer :tazz:

Edited by MaverickSidewinder, 26 November 2005 - 07:35 AM.

  • 0

Advertisements


#2
Neil Jones

Neil Jones

    Member 5k

  • Member
  • PipPipPipPipPipPipPipPip
  • 8,476 posts
Stick a dollar sign on the end of CHR. You'd probably do better to use separate lines for each line of the text box in this case so you can easily see what is supposed to be on a new line and what isn't.

Something like this:

txtStatus.Text = txtStatus.Text & "Line 1" & Chr$(13) & Chr$(10)
		txtStatus.Text = txtStatus.Text & "Line 2 on a new text box line " & Chr$(13) & Chr$(10)

A text box with the name txtStatus is needed. All you need do is basically use the previous contents of the box and stick the extra stuff on the end of it with a carriage return.
  • 0

#3
MaverickSidewinder

MaverickSidewinder

    Member

  • Topic Starter
  • Member
  • PipPipPip
  • 257 posts
I tried this..but it didn' work..it just comes on line and the Chr$(13) and (10) come up as ||

please help :tazz:

thanks :)
  • 0

#4
MaverickSidewinder

MaverickSidewinder

    Member

  • Topic Starter
  • Member
  • PipPipPip
  • 257 posts
====== RESOLVED ========

Thank you Neil Jones for the reply...

I ended up using the "vbCrLf" function :)

Thanks again :tazz:
  • 0






Similar Topics

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

As Featured On:

Microsoft Yahoo BBC MSN PC Magazine Washington Post HP