Chr(10) & Chr(13) 
Author Message
 Chr(10) & Chr(13)

Hi, i got a silly question, i want to replace, the Chr command from VB6, and
i don't want to use imports microsoft.visualbasic, so.... how can i do to do
chr(10) and chr(13) ???

Thanks.
Alex.



Fri, 11 Feb 2005 21:53:16 GMT  
 Chr(10) & Chr(13)
use
ControlChars.CrLf()

Quote:
> i don't want to use imports microsoft.visualbasic, so.... how can i do to
do
> chr(10) and chr(13) ???



Fri, 11 Feb 2005 22:12:11 GMT  
 Chr(10) & Chr(13)
ControlChars is in microsoft.visualbasic...

maybe this should help you...
Dim oChar As String = Convert.ToChar(13) & Convert.ToChar(10)

HTH
--
Corrado Cavalli
UGIdotNET - http://www.ugidotnet.org



Fri, 11 Feb 2005 22:36:04 GMT  
 Chr(10) & Chr(13)

Quote:
> ControlChars is in microsoft.visualbasic...

Oooppps,

so why bother writing ControlChars.CrLf()
instead of the good old vbCrLf ?

bye
Fabio



Fri, 11 Feb 2005 22:46:12 GMT  
 Chr(10) & Chr(13)
Thats part of Microsoft.VisualBasic also. Ale K. said he/she didn't want to
*use* the imported Microsoft.Visualbasic.Chr() proc, the reference is there
regardless. So just use the fully qualified name to refer to the original,
and the internal name for your custom proc:

Function Chr(ByVal CharCode As Integer) As Char
    'do something
    '...
    'or you can return orriginal val:
    Return Microsoft.VisualBasic.Chr(CharCode)
End Function

This happens by default, if you declare a public procedure that overloads an
internal procedure, your local copy will be called unless you use the fully
qualified name. Examples:

To call local (within current scope):
[your Chr() proc is declared in the same module your calling it from, or it
is in a public or imported module]

    Chr(13)

To call local (outside current scope):
[your Chr() proc is declared - should be shared - in some other module that
is not imported into the current module]
    MyStrings.Chr(13)

To call MS.VB (any):
    Microsoft.VisualBasic.Chr(13)

To use a global module to house your procs:

Public Class MyStrings
    Public Shared Function Chr(CharCode as Integer) as Char
        'do something
        'or return MS.VB value:
        Return Microsoft.VisualBasic.Chr(CharCode)
    End Function
End Class

and call it like this (this code is in a form - say Form1):

    Debug.WriteLine MyStrings.Chr(13)

Hope that helps


Quote:

> > ControlChars is in microsoft.visualbasic...

> Oooppps,

> so why bother writing ControlChars.CrLf()
> instead of the good old vbCrLf ?

> bye
> Fabio



Fri, 11 Feb 2005 23:17:56 GMT  
 Chr(10) & Chr(13)
Hi,

This is from a previous post I made:

It seems that they really want you to use this namespace, as there
are no literals for control characters in vb.net - C# has literals, like
"\n" etc.

What I have come up with is cumbersome, but it might do the trick. I have
found 2 ways, one is limited and the other tiring but complete.

    Public Sub Form1_Load(ByVal sender As Object, ByVal e As
System.EventArgs) Handles MyBase.Load

        '**Method 1 use environment namespace, but NewLine is the only
available control character
        MessageBox.Show("Method1:" + Environment.NewLine + "This text should
be on a new line!")

        '**Method 2 use environment namespace and convert newline to a
char - sort of useless I think
        Dim chNL As Char
        chNL = CType(Environment.NewLine, Char)
        MessageBox.Show("Method2:" + chNL + "This text should be on a new
line!")

        '**Method 3 use a decoder
        Dim chDEC(0) As Char
        Dim bControlChars As Byte() = {13}   '**char number in ASCII table
for CARRIAGE RETURN
        Dim dec As System.Text.Decoder =
System.Text.Encoding.UTF8.GetDecoder()
        dec.GetChars(bControlChars, 0, bControlChars.Length, chDEC, 0)
        MessageBox.Show("Method3" + chDEC(0) + "This text should be on a new
line!")

        '**Method 4 as method3 but use a decoder with a bunch of control
chars in an array
        Dim chDEC2(2) As Char
        Dim bControlChars2 As Byte() = {13, 10, 32} '**CARRIAGE RETURN, LINE
FEED, SPACE,
        Dim dec2 As System.Text.Decoder =
System.Text.Encoding.UTF8.GetDecoder()
        dec.GetChars(bControlChars2, 0, bControlChars2.Length, chDEC2, 0)
        MessageBox.Show("Method4.1" + chDEC2(0) + "This text should be on a
new line!")
        MessageBox.Show("Method4.2" + chDEC2(1) + "This text should be after
line feed!")
        MessageBox.Show("Method4.3" + chDEC2(2) + "There should be a space
before ""There""!")

        Application.Exit()

    End Sub

Thanks'
Paul


Quote:
> Hi, i got a silly question, i want to replace, the Chr command from VB6,
and
> i don't want to use imports microsoft.visualbasic, so.... how can i do to
do
> chr(10) and chr(13) ???

> Thanks.
> Alex.



Fri, 11 Feb 2005 23:19:46 GMT  
 Chr(10) & Chr(13)
Hi,

You can remove the reference to Microsoft.VisualBasic by going into your
project's properties, then "Common Properties", "Imports".

Thanks
Paul


Quote:
> Thats part of Microsoft.VisualBasic also. Ale K. said he/she didn't want
to
> *use* the imported Microsoft.Visualbasic.Chr() proc, the reference is
there
> regardless. So just use the fully qualified name to refer to the original,
> and the internal name for your custom proc:

> Function Chr(ByVal CharCode As Integer) As Char
>     'do something
>     '...
>     'or you can return orriginal val:
>     Return Microsoft.VisualBasic.Chr(CharCode)
> End Function

> This happens by default, if you declare a public procedure that overloads
an
> internal procedure, your local copy will be called unless you use the
fully
> qualified name. Examples:

> To call local (within current scope):
> [your Chr() proc is declared in the same module your calling it from, or
it
> is in a public or imported module]

>     Chr(13)

> To call local (outside current scope):
> [your Chr() proc is declared - should be shared - in some other module
that
> is not imported into the current module]
>     MyStrings.Chr(13)

> To call MS.VB (any):
>     Microsoft.VisualBasic.Chr(13)

> To use a global module to house your procs:

> Public Class MyStrings
>     Public Shared Function Chr(CharCode as Integer) as Char
>         'do something
>         'or return MS.VB value:
>         Return Microsoft.VisualBasic.Chr(CharCode)
>     End Function
> End Class

> and call it like this (this code is in a form - say Form1):

>     Debug.WriteLine MyStrings.Chr(13)

> Hope that helps



> > > ControlChars is in microsoft.visualbasic...

> > Oooppps,

> > so why bother writing ControlChars.CrLf()
> > instead of the good old vbCrLf ?

> > bye
> > Fabio



Sat, 12 Feb 2005 00:36:20 GMT  
 Chr(10) & Chr(13)
Paul,

FOOL! That is just the auto import (hence the title "Imports"), the
reference is still there. :-)  Regardless, the question was how to call a
custom Chr() function instead of the Microsoft.VisualBasic proc.

Jeremy

Quote:

> Hi,

> You can remove the reference to Microsoft.VisualBasic by going into your
> project's properties, then "Common Properties", "Imports".

> Thanks
> Paul



> > Thats part of Microsoft.VisualBasic also. Ale K. said he/she didn't want
> to
> > *use* the imported Microsoft.Visualbasic.Chr() proc, the reference is
> there
> > regardless. So just use the fully qualified name to refer to the
original,
> > and the internal name for your custom proc:

> > Function Chr(ByVal CharCode As Integer) As Char
> >     'do something
> >     '...
> >     'or you can return orriginal val:
> >     Return Microsoft.VisualBasic.Chr(CharCode)
> > End Function

> > This happens by default, if you declare a public procedure that
overloads
> an
> > internal procedure, your local copy will be called unless you use the
> fully
> > qualified name. Examples:

> > To call local (within current scope):
> > [your Chr() proc is declared in the same module your calling it from, or
> it
> > is in a public or imported module]

> >     Chr(13)

> > To call local (outside current scope):
> > [your Chr() proc is declared - should be shared - in some other module
> that
> > is not imported into the current module]
> >     MyStrings.Chr(13)

> > To call MS.VB (any):
> >     Microsoft.VisualBasic.Chr(13)

> > To use a global module to house your procs:

> > Public Class MyStrings
> >     Public Shared Function Chr(CharCode as Integer) as Char
> >         'do something
> >         'or return MS.VB value:
> >         Return Microsoft.VisualBasic.Chr(CharCode)
> >     End Function
> > End Class

> > and call it like this (this code is in a form - say Form1):

> >     Debug.WriteLine MyStrings.Chr(13)

> > Hope that helps



> > > > ControlChars is in microsoft.visualbasic...

> > > Oooppps,

> > > so why bother writing ControlChars.CrLf()
> > > instead of the good old vbCrLf ?

> > > bye
> > > Fabio



Sat, 12 Feb 2005 02:44:07 GMT  
 Chr(10) & Chr(13)
Try Environment.NewLine()

HTH,

--
Kevin Spencer
Microsoft FrontPage MVP
Internet Programmer
For ASP Tutorials and Information -
http://www.takempis.com


Quote:
> Paul,

> FOOL! That is just the auto import (hence the title "Imports"), the
> reference is still there. :-)  Regardless, the question was how to call a
> custom Chr() function instead of the Microsoft.VisualBasic proc.

> Jeremy


> > Hi,

> > You can remove the reference to Microsoft.VisualBasic by going into your
> > project's properties, then "Common Properties", "Imports".

> > Thanks
> > Paul



> > > Thats part of Microsoft.VisualBasic also. Ale K. said he/she didn't
want
> > to
> > > *use* the imported Microsoft.Visualbasic.Chr() proc, the reference is
> > there
> > > regardless. So just use the fully qualified name to refer to the
> original,
> > > and the internal name for your custom proc:

> > > Function Chr(ByVal CharCode As Integer) As Char
> > >     'do something
> > >     '...
> > >     'or you can return orriginal val:
> > >     Return Microsoft.VisualBasic.Chr(CharCode)
> > > End Function

> > > This happens by default, if you declare a public procedure that
> overloads
> > an
> > > internal procedure, your local copy will be called unless you use the
> > fully
> > > qualified name. Examples:

> > > To call local (within current scope):
> > > [your Chr() proc is declared in the same module your calling it from,
or
> > it
> > > is in a public or imported module]

> > >     Chr(13)

> > > To call local (outside current scope):
> > > [your Chr() proc is declared - should be shared - in some other module
> > that
> > > is not imported into the current module]
> > >     MyStrings.Chr(13)

> > > To call MS.VB (any):
> > >     Microsoft.VisualBasic.Chr(13)

> > > To use a global module to house your procs:

> > > Public Class MyStrings
> > >     Public Shared Function Chr(CharCode as Integer) as Char
> > >         'do something
> > >         'or return MS.VB value:
> > >         Return Microsoft.VisualBasic.Chr(CharCode)
> > >     End Function
> > > End Class

> > > and call it like this (this code is in a form - say Form1):

> > >     Debug.WriteLine MyStrings.Chr(13)

> > > Hope that helps



> > > > > ControlChars is in microsoft.visualbasic...

> > > > Oooppps,

> > > > so why bother writing ControlChars.CrLf()
> > > > instead of the good old vbCrLf ?

> > > > bye
> > > > Fabio



Sat, 12 Feb 2005 03:35:28 GMT  
 Chr(10) & Chr(13)
Paul,

Your previous post:

Quote:
>>You can remove the reference to Microsoft.VisualBasic by going into your

project's properties, then "Common Properties", "Imports".

I don't see anything about explicit calls, but I won't argue semantics. I
just wanted to make it painfully clear that it was a false statement to
anyone who thought they could remove a reference by removing the import.

Cheerios,
Jeremy

Quote:

> Hi Jeremy,

> You seem a bit e{*filter*}d there. If you remove the Import, you will at least
> know explicitly when you are using the microsoft.visualbasic namespace, as
> you will have to use the complete namespace name. That was my point with
the
> previous post.

> As for the replacing the chr function from  microsoft.visualbasic, look at
> the attached text file. I had the code in a previous post as well.

> Cheers
> Paul



> > Paul,

> > FOOL! That is just the auto import (hence the title "Imports"), the
> > reference is still there. :-)  Regardless, the question was how to call
a
> > custom Chr() function instead of the Microsoft.VisualBasic proc.

> > Jeremy


> > > Hi,

> > > You can remove the reference to Microsoft.VisualBasic by going into
your
> > > project's properties, then "Common Properties", "Imports".

> > > Thanks
> > > Paul



> > > > Thats part of Microsoft.VisualBasic also. Ale K. said he/she didn't
> want
> > > to
> > > > *use* the imported Microsoft.Visualbasic.Chr() proc, the reference
is
> > > there
> > > > regardless. So just use the fully qualified name to refer to the
> > original,
> > > > and the internal name for your custom proc:

> > > > Function Chr(ByVal CharCode As Integer) As Char
> > > >     'do something
> > > >     '...
> > > >     'or you can return orriginal val:
> > > >     Return Microsoft.VisualBasic.Chr(CharCode)
> > > > End Function

> > > > This happens by default, if you declare a public procedure that
> > overloads
> > > an
> > > > internal procedure, your local copy will be called unless you use
the
> > > fully
> > > > qualified name. Examples:

> > > > To call local (within current scope):
> > > > [your Chr() proc is declared in the same module your calling it
from,
> or
> > > it
> > > > is in a public or imported module]

> > > >     Chr(13)

> > > > To call local (outside current scope):
> > > > [your Chr() proc is declared - should be shared - in some other
module
> > > that
> > > > is not imported into the current module]
> > > >     MyStrings.Chr(13)

> > > > To call MS.VB (any):
> > > >     Microsoft.VisualBasic.Chr(13)

> > > > To use a global module to house your procs:

> > > > Public Class MyStrings
> > > >     Public Shared Function Chr(CharCode as Integer) as Char
> > > >         'do something
> > > >         'or return MS.VB value:
> > > >         Return Microsoft.VisualBasic.Chr(CharCode)
> > > >     End Function
> > > > End Class

> > > > and call it like this (this code is in a form - say Form1):

> > > >     Debug.WriteLine MyStrings.Chr(13)

> > > > Hope that helps



> > > > > > ControlChars is in microsoft.visualbasic...

> > > > > Oooppps,

> > > > > so why bother writing ControlChars.CrLf()
> > > > > instead of the good old vbCrLf ?

> > > > > bye
> > > > > Fabio



Sat, 12 Feb 2005 04:50:50 GMT  
 
 [ 10 post ] 

 Relevant Pages 

1. chr(10) and chr(13) in memofield gives |

2. Chr(10) and Chr(13) doesn't work

3. INPUT OR READ TO STRIP CHR(10) AND CHR(13)

4. What is chr$(13) + chr$(10)

5. vbCRLF = chr(13) + chr(10)

6. is carriage return chr(13) or chr(32)

7. chr(13) & chr(10) in a text box

8. No Sentences in Title?! / No Chr(10) or Chr(13) in titles!!!

9. Global Const CR = chr$(13) + chr$(10) uh oh!?

10. Display chr$(30) & chr$(31)

11. 


12. Enter Parameter value CHR(13)

 

 
Powered by phpBB® Forum Software