Right() function versus microsoft.visualbasic.right() function


  • I have just recently upgraded to Visual Basic 2008 Express Edition from VB6.  I was trying to use the right() function for string manipulation.  I learned through a lot of web searches that I need to use micorosoft.visualbasic.right().  Is this the only way to do this?  Why did they modifiy this and does it relate to all similar functions that used to be easier in VB 6? 




    Monday, September 29, 2008 11:10 AM


  • Many controls, including your form, have a Right property so if you don't use the fully qualified name then VB assumes you mean the Right property of the form and not the Right function which is part of the Microsoft.VisualBasic namespace.  You will have the same problem with Left and probably some others.  For all the other functions provided you have imported the Microsoft.VisualBasic namespace there is no need to use the fully qualified name.  Generally though there are .Net equivalents to the methods in this namespace and you should try to use those instead.  For example you can use the String.Substring method rather than the VB Right and Left methods.

    Monday, September 29, 2008 11:33 AM