Results 1 to 3 of 3

Thread: Are these commands different ?

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Aug 2000
    Location
    UK
    Posts
    78

    Are these commands different ?

    Both methods below work fine in VB.NET, it's doesn't do anything as such, just showing different syntax. What I want to know is, Is there a difference ?

    Once I add the 'import' it will then allow me to go either 'dir' or 'vb.dir', are they both doing exactly the same thing ? Which one is prefered ? Is it just syntax ? Or something else ?

    Thanks

    Imports VB = Microsoft.VisualBasic

    METHOD 1:

    Dim Test As String
    Test = Dir("C:\")
    Test = "1234567"
    If IsNumeric(Test) Then
    '...
    End If
    Test = Format(Test, "#,###,###")

    METHOD 2:

    Dim Test As String
    Test = VB.Dir("C:\")
    Test = "1234567"
    If VB.IsNumeric(Test) Then
    '...
    End If
    Test = VB.Format(Test, "#,###,###")

  2. #2
    Banished Cander's Avatar
    Join Date
    Dec 2000
    Location
    Why do you care?
    Posts
    6,913
    Imports are just shortcuts and are not required. Neither wayu is faster..it all about saving the dev typing..
    Stack Overflow
    See the features of Visual Studio 2010 and C# 4.0: The 10-4 show on Channel9

  3. #3
    Frenzied Member DevGrp's Avatar
    Join Date
    Nov 2001
    Location
    Charlotte, NC
    Posts
    1,256
    What Cander said, just saves you from typing Microsoft.VisualBasic.
    Dont gain the world and lose your soul

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