Search...can't find anything. Booooo.
Anyone?
Woof
Printable View
Search...can't find anything. Booooo.
Anyone?
Woof
dont know if its .NET, but you can try "ControlChars.CrLf"
Spot on! :D
Cheers.
Woof
Hi,
Why do you object to VBCrLf ?
The MSDN Help reference from VBCrLf is exactly the same as from ControlCharacters
vbCrlf is a VB6 constant.
It comes from the System.VisualBasic namespace.
Why use soemthing in .NET that is only there for histprical reasons, and coz loads of VB6 developers whinged about it.
Woka
you could also use:
VB Code:
Chr(13) + Chr(10)
Microsoft.VisualBasic ;)Quote:
Originally Posted by Wokawidget
And I hate to break it to you, but the ControlChars class is in that namespace as well.
:afrog:
What about the System.Environment.NewLine constant in VB.NET?
What?! Another method?!
Why? What? How?
Which one?!
:(
I hate .NET
Woof
It's alright to realize that you're not good enough for it. :DQuote:
Originally Posted by Wokawidget
Hi,
You mean you hate being spoiled for choice??
They all work and VBcrlf is the shortest :bigyello:
environment.newline is the best by far.. it works in places that crlf doesn't work.. like in balloon tips (possibly in tooltips.. but i didnt test them)
I am good enough to use .NET, which is why I am noticing their are problems you muppet :D
Errrr...That's nice to know about the different methods not working in different objects :D Bad MS *SLAP*
So...which one to use?
vbCrLf is from VB6. I will NOT use any legacy code in .NET
Woka
well woka if you notice, controlchars.crlf = vbcrlf :bigyello:
Whats wrong with VbCrLf ?
it works fine althought I agree with kleinma that Envinroment.NewLine is better.
nothing is wrong with it (other than its limitations versus environment.newline)Quote:
Originally Posted by apolizoi
but a lot of people that move to VB.NET from VB6 try to stay away from VB6 things, which are in the Microsoft.VisualBasic namespace... because they are only there to save VB6 people from having to learn everything.. I don't know of anything in the VB6 namespace that can't be accomplished another way...
Fiddling a bit with types got me this way of doing it without Microsoft.VisualBasic :
VB Code:
Dim sTest As String sTest = "Hello" sTest += Convert.ToChar(13).ToString() + Convert.ToChar(10).ToString() sTest += "How r u?"
yeah but look at all the methods you are using there, yo uare calling tostring and tochar twice...Quote:
Originally Posted by sixfeetsix
stest = "Hello" & Environment.Newline & "how r u?"
would give you the same result...
Yeah, I don't face that problem usually, cause from VB6, I went (almost) directly to C# since I am used to C and C++.
So I can use "\r\n".
Also, when I have to use VB .Net, I remove Microsoft.VisualBasic from the general Imports, and I then define a string (pseudo) constant with "Convert.ToChar(13).ToString() + Convert.ToChar(10).ToString()" when I need it.
VB Code:
Dim NL As String = Convert.ToChar(13).ToString() + Convert.ToChar(10).ToString()