Results 1 to 19 of 19

Thread: vbCrLf replacement in .NET (RESPOLVED)

  1. #1

  2. #2
    Frenzied Member tr333's Avatar
    Join Date
    Nov 2004
    Location
    /dev/st0
    Posts
    1,605

    Re: vbCrLf replacement in .NET

    dont know if its .NET, but you can try "ControlChars.CrLf"
    CSS layout comes in to the 21st century with flexbox!
    Just another Perl hacker,

  3. #3

  4. #4
    PowerPoster
    Join Date
    Dec 2003
    Location
    Bristol, England (but heart is in Virginia)
    Posts
    2,949

    Re: vbCrLf replacement in .NET (RESPOLVED)

    Hi,

    Why do you object to VBCrLf ?

    The MSDN Help reference from VBCrLf is exactly the same as from ControlCharacters
    Taxes
    The more I learn about VB.NET the more I like dBaseIII Plus

    The foregoing, whilst believed to be correct, is given without guarantee as to it's accuracy and entirely without recourse. You are required to decide for yourself whether or not it is suitable for your purposes and no liability for loss of any nature can be entertained.

  5. #5

    Thread Starter
    Super Moderator Wokawidget's Avatar
    Join Date
    Nov 2001
    Location
    Headingly Occupation: Classified
    Posts
    9,632

    Re: vbCrLf replacement in .NET (RESPOLVED)

    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

  6. #6
    Frenzied Member tr333's Avatar
    Join Date
    Nov 2004
    Location
    /dev/st0
    Posts
    1,605

    Re: vbCrLf replacement in .NET (RESPOLVED)

    you could also use:
    VB Code:
    1. Chr(13) + Chr(10)
    CSS layout comes in to the 21st century with flexbox!
    Just another Perl hacker,

  7. #7
    The Devil crptcblade's Avatar
    Join Date
    Aug 2000
    Location
    Quetzalshacatenango
    Posts
    9,091

    Re: vbCrLf replacement in .NET (RESPOLVED)

    Quote Originally Posted by Wokawidget
    vbCrlf is a VB6 constant.
    It comes from the System.VisualBasic namespace.
    Microsoft.VisualBasic

    And I hate to break it to you, but the ControlChars class is in that namespace as well.

    Laugh, and the world laughs with you. Cry, and you just water down your vodka.


    Take credit, not responsibility

  8. #8
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    Re: vbCrLf replacement in .NET (RESPOLVED)

    What about the System.Environment.NewLine constant in VB.NET?

  9. #9

  10. #10
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    Re: vbCrLf replacement in .NET (RESPOLVED)

    Quote Originally Posted by Wokawidget
    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.

  11. #11
    PowerPoster
    Join Date
    Dec 2003
    Location
    Bristol, England (but heart is in Virginia)
    Posts
    2,949

    Re: vbCrLf replacement in .NET (RESPOLVED)

    Hi,

    You mean you hate being spoiled for choice??

    They all work and VBcrlf is the shortest
    Taxes
    The more I learn about VB.NET the more I like dBaseIII Plus

    The foregoing, whilst believed to be correct, is given without guarantee as to it's accuracy and entirely without recourse. You are required to decide for yourself whether or not it is suitable for your purposes and no liability for loss of any nature can be entertained.

  12. #12
    I'm about to be a PowerPoster! kleinma's Avatar
    Join Date
    Nov 2001
    Location
    NJ - USA (Near NYC)
    Posts
    23,373

    Re: vbCrLf replacement in .NET (RESPOLVED)

    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)

  13. #13

    Thread Starter
    Super Moderator Wokawidget's Avatar
    Join Date
    Nov 2001
    Location
    Headingly Occupation: Classified
    Posts
    9,632

    Re: vbCrLf replacement in .NET (RESPOLVED)

    I am good enough to use .NET, which is why I am noticing their are problems you muppet


    Errrr...That's nice to know about the different methods not working in different objects Bad MS *SLAP*

    So...which one to use?

    vbCrLf is from VB6. I will NOT use any legacy code in .NET

    Woka

  14. #14
    I'm about to be a PowerPoster! kleinma's Avatar
    Join Date
    Nov 2001
    Location
    NJ - USA (Near NYC)
    Posts
    23,373

    Re: vbCrLf replacement in .NET (RESPOLVED)

    well woka if you notice, controlchars.crlf = vbcrlf
    Attached Images Attached Images  

  15. #15
    Member apolizoi's Avatar
    Join Date
    Jan 2005
    Location
    Greece
    Posts
    44

    Re: vbCrLf replacement in .NET (RESPOLVED)

    Whats wrong with VbCrLf ?
    it works fine althought I agree with kleinma that Envinroment.NewLine is better.

  16. #16
    I'm about to be a PowerPoster! kleinma's Avatar
    Join Date
    Nov 2001
    Location
    NJ - USA (Near NYC)
    Posts
    23,373

    Re: vbCrLf replacement in .NET (RESPOLVED)

    Quote Originally Posted by apolizoi
    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)

    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...

  17. #17
    Addicted Member
    Join Date
    Jan 2005
    Location
    Montréal
    Posts
    160

    Re: vbCrLf replacement in .NET (RESPOLVED)

    Fiddling a bit with types got me this way of doing it without Microsoft.VisualBasic :

    VB Code:
    1. Dim sTest As String
    2.  
    3.         sTest = "Hello"
    4.         sTest += Convert.ToChar(13).ToString() + Convert.ToChar(10).ToString()
    5.         sTest += "How r u?"
    There are no stupid questions, but a whole bunch of dumb sayings !

    Save time on database code, try DataLG !

  18. #18
    I'm about to be a PowerPoster! kleinma's Avatar
    Join Date
    Nov 2001
    Location
    NJ - USA (Near NYC)
    Posts
    23,373

    Re: vbCrLf replacement in .NET (RESPOLVED)

    Quote Originally Posted by sixfeetsix
    Fiddling a bit with types got me this way of doing it without Microsoft.VisualBasic :

    VB Code:
    1. Dim sTest As String
    2.  
    3.         sTest = "Hello"
    4.         sTest += Convert.ToChar(13).ToString() + Convert.ToChar(10).ToString()
    5.         sTest += "How r u?"
    yeah but look at all the methods you are using there, yo uare calling tostring and tochar twice...

    stest = "Hello" & Environment.Newline & "how r u?"

    would give you the same result...

  19. #19
    Addicted Member
    Join Date
    Jan 2005
    Location
    Montréal
    Posts
    160

    Re: vbCrLf replacement in .NET (RESPOLVED)

    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:
    1. Dim NL As String = Convert.ToChar(13).ToString() + Convert.ToChar(10).ToString()
    Last edited by sixfeetsix; Feb 17th, 2005 at 06:44 PM.
    There are no stupid questions, but a whole bunch of dumb sayings !

    Save time on database code, try DataLG !

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width