ControlChars.Lf, ControlChars.Cr, ControlChars.CrLf

  • Thread starter Thread starter kerberoz
  • Start date Start date
K

kerberoz

whats the equivalent following ControlChars.Lf, ControlChars.Cr,
ControlChars.CrLf code in vb.net
 
LF 10 CR 13

chr(13)
chr(10)

But you can use the controlchar. also.
whats the equivalent following ControlChars.Lf, ControlChars.Cr,
ControlChars.CrLf code in vb.net
I hope this helps?

Cor
 
kerberoz said:
whats the equivalent following ControlChars.Lf, ControlChars.Cr,
ControlChars.CrLf code in vb.net

Equivalent? I don't know what you mean, but there is also
Microsoft.VisualBasic.Constants.vbCrLf
Microsoft.VisualBasic.Constants.vbCr
Microsoft.VisualBasic.Constants.vbLf

not to forget
Microsoft.VisualBasic.ControlChars.NewLine
System.Environment.NewLine
 
* "kerberoz said:
whats the equivalent following ControlChars.Lf, ControlChars.Cr,
ControlChars.CrLf code in vb.net

The constants you mentioned!
 
kerberoz,
As the others have mentioned the equivalents of:
ControlChars.Lf, ControlChars.Cr,
ControlChars.CrLf

are ControlChars.Lf, ControlChars.Cr,ControlChars.CrLf

Can you give a little more detail on what you are asking?

Hope this helps
Jay
 
ok here is what i mean..... ControlChars needs an imports to the
Microsoft.VisualBasic namespace... what i need to know is what the
equivalent of this in pure .NET symantics?

TIA guys :)
 
Kerberoz,
What exactly do you mean by "pure .NET semantics"???

VB.NET is a .NET language, Microsoft.VisualBasic is VB.NET's helper
functions, ergo Microsoft.VisualBasic is .NET.

Yes there are things in Microsoft.VisualBasic that I try to avoid in favor
of the Framework itself, however there are things in Microsoft.VisualBasic
that significantly simplify your code. Making blanket statements to avoid
Microsoft.VisualBasic doesn't particularly make sense to me.

Of course I will strongly recommend you avoid
Microsoft.VisualBasic.Compatibility, as it is there for upgraded VB6
projects. Over the course of time, I slowly Refactor
(http://www.refactoring.com) Microsoft.VisualBasic.Compatibility out of the
picture of my projects I upgraded from VB6.

If you use Object Browser to see the definition of ControlChars.Cr you will
see that it is defined as:

Public Shared Const Cr As Char = ChrW(13)

In the above context ChrW is a constant function, evaluated at compile time.

Hope this helps
Jay
 
Hi Kerberoz,

Just as a reading comment to the text of Jay B.

What Jay B is writing is all true, but when you read it, you can mix up
Microsoft.VisualBasic with Microsoft.VisualBasic compatibility namespace.

That are 2 different things.

I hope this helps?

Cor

The quoting beneath is very much changed, so if you want to have the real
text look above this.
VB.NET is a .NET language, Microsoft.VisualBasic is VB.NET's helper
functions, ergo Microsoft.VisualBasic is .NET.

. Over the course of time, I slowly Refactor
Microsoft.VisualBasic.Compatibility out of the
 
* "kerberoz said:
ok here is what i mean..... ControlChars needs an imports to the
Microsoft.VisualBasic namespace... what i need to know is what the
equivalent of this in pure .NET symantics?

There are no direct equivalents. There is 'Environment.NewLine', there
is the 'Convert.ToChar' method. And there is 'Chr' and 'ChrW', but that
are both part of Visual Basic .NET too. I /would/ recommend to use the
constants provided in 'ControlChars'.
 
Back
Top