Results 1 to 5 of 5

Thread: VB6 Functions In C#

  1. #1

    Thread Starter
    Addicted Member señorbadger's Avatar
    Join Date
    Oct 2003
    Location
    Mud pools of wellingborough
    Posts
    193

    VB6 Functions In C#

    Hey people

    im learning c# and was wondering what the equivalents are of functions in VB 6 like
    VB Code:
    1. chr()
    2. asc()
    3. now()
    4. mid()
    5. split()
    6. left()
    7. right()
    8. strreverse()
    i looked on google but cant see much about them

  2. #2
    PowerPoster hellswraith's Avatar
    Join Date
    Jul 2002
    Location
    Washington St.
    Posts
    2,464
    chr() - ?
    asc() - ?
    now() - DateTime.Now
    mid() - myString.SubString(5,3)
    split() - myString.Split(" ")
    left() - myString.SubString(0, 5)
    right() - myString.SubString(myString.Length - 5)
    strreverse() - ?

    Sorry I don't know the others off the top of my head. Look at the different functions you can do with a string variable. This will lead you to answering what you need answered. There is also the System.Text namespace, or the char data type that allows other things.

  3. #3
    Serge's Avatar
    Join Date
    Feb 1999
    Location
    Scottsdale, Arizona, USA
    Posts
    2,744
    Chr()
    Convert.ToString(65)

    Asc()
    Convert.ToByte('A')

  4. #4
    Frenzied Member dynamic_sysop's Avatar
    Join Date
    Jun 2003
    Location
    Ashby, Leicestershire.
    Posts
    1,142
    a couple more Chr variations ...
    VB Code:
    1. char chr = (char)65; // same as Chr(65)
    2. char chr1 = Convert.ToChar(65); // same as Chr(65)
    ~
    if a post is resolved, please mark it as [Resolved]
    protected string get_Signature(){return Censored;}
    [vbcode][php] please use code tags when posting any code [/php][/vbcode]

  5. #5
    Frenzied Member dynamic_sysop's Avatar
    Join Date
    Jun 2003
    Location
    Ashby, Leicestershire.
    Posts
    1,142
    i dug out a function i made ages ago in C# for reversing strings , here ya go...
    PHP Code:
            private void button1_Click(object senderSystem.EventArgs e)
            {
                
    MessageBox.Show(StringReverse("test 123"));
            }

            private 
    string StringReverse(string ToReverse)
            {
                Array 
    arr ToReverse.ToCharArray();
                Array.
    Reversearr ); // reverse the string
                
    char[] = (char[])arr;
                
    byte[] System.Text.Encoding.Default.GetBytes(c);
                return 
    System.Text.Encoding.Default.GetString(b);
            } 
    Last edited by dynamic_sysop; May 11th, 2004 at 03:55 PM.
    ~
    if a post is resolved, please mark it as [Resolved]
    protected string get_Signature(){return Censored;}
    [vbcode][php] please use code tags when posting any code [/php][/vbcode]

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