Results 1 to 11 of 11

Thread: Right() Function

  1. #1

    Thread Starter
    Fanatic Member pvbangera's Avatar
    Join Date
    Sep 2001
    Location
    Mumbai, India
    Posts
    961

    Right() Function

    What is the replacement for VB6's Right() function in VB.Net?

  2. #2
    Frenzied Member dynamic_sysop's Avatar
    Join Date
    Jun 2003
    Location
    Ashby, Leicestershire.
    Posts
    1,142
    use the Substring function , eg:
    VB Code:
    1. Dim s As String = "test 123"
    2.         MessageBox.Show(s.Substring(s.Length - 3))
    ~
    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]

  3. #3

    Thread Starter
    Fanatic Member pvbangera's Avatar
    Join Date
    Sep 2001
    Location
    Mumbai, India
    Posts
    961
    That's fine. There are so many ways to achieve the result. But is there any built-in function in VB.Net?

    I just wonder, why they removed such an useful function!!

  4. #4
    PowerPoster
    Join Date
    Dec 2003
    Location
    Bristol, England (but heart is in Virginia)
    Posts
    2,949
    What's with you guys

    The Right function is still with us. Of course it cannot be used in any class which has a Right property (as with Left etc) such as a form but you then use

    VB Code:
    1. Microsoft.VisualBasic.Right

    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
    Fanatic Member pvbangera's Avatar
    Join Date
    Sep 2001
    Location
    Mumbai, India
    Posts
    961
    Common taxes,

    Everybody knows that.

    But that's an additional reference to Microsoft.VisualBasic namespace.

    What if I want to avoid it?

  6. #6
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083
    Originally posted by pvbangera
    What if I want to avoid it?
    then you have to follow what sysop suggested .

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

    Everybody knows that. "


    OK. I'll assume you know everything in future. Bye
    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.

  8. #8
    Frenzied Member
    Join Date
    Nov 2003
    Posts
    1,489
    The substring IS native to .net. It's the "proper" way of getting your results. you can use the right() function but i've HEARD through the grapevine that some older functions will lose portability when Whidbey comes around the mountain

  9. #9
    Frenzied Member dynamic_sysop's Avatar
    Join Date
    Jun 2003
    Location
    Ashby, Leicestershire.
    Posts
    1,142
    well as i said use the Substring function , but whidbey hasn't lost the visual basic Right function i run whidbey and this is straight from it ...
    VB Code:
    1. Dim s As String = "test 123"
    2.  
    3.         MessageBox.Show(Microsoft.VisualBasic.Right(s, 3))
    ~
    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]

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

    " MessageBox.Show(Microsoft.VisualBasic.Right(s, 3))"


    So. This function already exists in VB.NET. What is all the fuss? VB.NET even allows you to use


    MessageBox.Show(Right(s, 3))

    in a module.
    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.

  11. #11

    Thread Starter
    Fanatic Member pvbangera's Avatar
    Join Date
    Sep 2001
    Location
    Mumbai, India
    Posts
    961
    I thinx Taxes is too sensitive. That was a very rude "Bye"

    Well, I think
    VB Code:
    1. MessageBox.Show(Right(s, 3))

    needs
    VB Code:
    1. Imports Microsoft.VisualBasic

    statement on top of your class.

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