visual basic new line text box

Soldato
Joined
6 Oct 2004
Posts
20,265
Location
England
In visual basic how do you get a new line when using a textbox without having to put loads of spaces? I have written one line, and want another directly below it (like a list) but i have to put loads of spaces to make it go below. I have the text set to multiline.

I looked on the net but couldnt really find anything, is vbNewLine relevant?
 
happytechie said:
embedding a \n in the string should work as well

"so this is a static string \n with a new line character in it"

Paul
That will not work in VB. You can do vbNewLine or vbCrLf

TrUz
 
TrUz said:
That will not work in VB. You can do vbNewLine or vbCrLf

TrUz

madness...

this:

private void button1_Click(object sender, System.EventArgs e)
{
MessageBox.Show("newline \n test");
}

is of course fine in C# and works perfectly

but this:

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
MessageBox.Show("thisis a test \n of excape chars")
End Sub

doesn't

and I've got to go and wash now, I've written some VB ;)
 
happytechie said:
madness...

this:

private void button1_Click(object sender, System.EventArgs e)
{
MessageBox.Show("newline \n test");
}

is of course fine in C# and works perfectly

but this:

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
MessageBox.Show("thisis a test \n of excape chars")
End Sub

doesn't

and I've got to go and wash now, I've written some VB ;)
Go clean yourself boy! :) I am feeling a bit dirty too, I have got to modify a VB project here at work. Unfortunatly I cannot use .NET as the machines do not have it installed!!!
 
that means that you're going to be using VB 6 :eek:

gah horrid stuff

be carefull you might start to like it and get used to dims and no semicolons.

the VB above failed to compile onthe first attempt 'cos it moaned at me that ; was an illegal character :rolleyes:

HT
 
I will not get used to the VB syntax, trust me! :) I find the C/C++/C# syntax much easier to work with, and it is a lot more readable. I find it is anyway. :)
 
Back
Top Bottom