Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. What is the difference between VB and VB.NET?

What is the difference between VB and VB.NET?

Scheduled Pinned Locked Moved Visual Basic
helpquestioncsharpc++
8 Posts 8 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    Sarfraz Munna
    wrote on last edited by
    #1

    Now VB.NET is object-oriented language. The following are some of the differences: Data Type Changes The .NET platform provides Common Type System to all the supported languages. This means that all the languages must support the same data types as enforced by common language runtime. This eliminates data type incompatibilities between various languages. For example on the 32-bit Windows platform, the integer data type takes 4 bytes in languages like C++ whereas in VB it takes 2 bytes. Following are the main changes related to data types in VB.NET: . Under .NET the integer data type in VB.NET is also 4 bytes in size. . VB.NET has no currency data type. Instead it provides decimal as a replacement. . VB.NET introduces a new data type called Char. The char data type takes 2 bytes and can store Unicode characters. . VB.NET do not have Variant data type. To achieve a result similar to variant type you can use Object data type. (Since every thing in .NET including primitive data types is an object, a variable of object type can point to any data type). . In VB.NET there is no concept of fixed length strings. . In VB6 we used the Type keyword to declare our user-defined structures. VB.NET introduces the structure keyword for the same purpose. Declaring Variables Consider this simple example in VB6: Dim x,y as integer In this example VB6 will consider x as variant and y as integer, which is somewhat odd behavior. VB.NET corrects this problem, creating both x and y as integers. Furthermore, VB.NET allows you to assign initial values to the variables in the declaration statement itself: br> Dim str1 as string = Hello VB.NET also introduces Read-Only variables. Unlike constants Read-Only variables can be declared without initialization but once you assign a value to it, it cannot be changes. Initialization here Dim readonly x as integer In later code X=100 Now x can’t be changed X=200 *********** Error ********** Property Syntax In VB.NET, we anymore don't have separate declarations for Get and Set/Let. Now, everything is done in a single property declaration. This can be better explained by the following example. Public [ReadOnly | WriteOnly] Property PropertyName as Datatype Get Return m_var End Get Set M_var = value End Set End Property Example: Private _message as String Public Property Message As String Get Return _message End Get Set _message = Value End Set End Property ByVal is the default - This is a crucial difference betwen VB 6.0 and V

    V A C S G 5 Replies Last reply
    0
    • S Sarfraz Munna

      Now VB.NET is object-oriented language. The following are some of the differences: Data Type Changes The .NET platform provides Common Type System to all the supported languages. This means that all the languages must support the same data types as enforced by common language runtime. This eliminates data type incompatibilities between various languages. For example on the 32-bit Windows platform, the integer data type takes 4 bytes in languages like C++ whereas in VB it takes 2 bytes. Following are the main changes related to data types in VB.NET: . Under .NET the integer data type in VB.NET is also 4 bytes in size. . VB.NET has no currency data type. Instead it provides decimal as a replacement. . VB.NET introduces a new data type called Char. The char data type takes 2 bytes and can store Unicode characters. . VB.NET do not have Variant data type. To achieve a result similar to variant type you can use Object data type. (Since every thing in .NET including primitive data types is an object, a variable of object type can point to any data type). . In VB.NET there is no concept of fixed length strings. . In VB6 we used the Type keyword to declare our user-defined structures. VB.NET introduces the structure keyword for the same purpose. Declaring Variables Consider this simple example in VB6: Dim x,y as integer In this example VB6 will consider x as variant and y as integer, which is somewhat odd behavior. VB.NET corrects this problem, creating both x and y as integers. Furthermore, VB.NET allows you to assign initial values to the variables in the declaration statement itself: br> Dim str1 as string = Hello VB.NET also introduces Read-Only variables. Unlike constants Read-Only variables can be declared without initialization but once you assign a value to it, it cannot be changes. Initialization here Dim readonly x as integer In later code X=100 Now x can’t be changed X=200 *********** Error ********** Property Syntax In VB.NET, we anymore don't have separate declarations for Get and Set/Let. Now, everything is done in a single property declaration. This can be better explained by the following example. Public [ReadOnly | WriteOnly] Property PropertyName as Datatype Get Return m_var End Get Set M_var = value End Set End Property Example: Private _message as String Public Property Message As String Get Return _message End Get Set _message = Value End Set End Property ByVal is the default - This is a crucial difference betwen VB 6.0 and V

      V Offline
      V Offline
      Vasudevan Deepak Kumar
      wrote on last edited by
      #2

      You already dumped this crap here: http://www.codeproject.com/script/Forums/View.aspx?fid=1649&msg=2573094[^]

      Vasudevan Deepak Kumar Personal Homepage
      Tech Gossips
      A pessimist sees only the dark side of the clouds, and mopes; a philosopher sees both sides, and shrugs; an optimist doesn't see the clouds at all - he's walking on them. --Leonard Louis Levinson

      1 Reply Last reply
      0
      • S Sarfraz Munna

        Now VB.NET is object-oriented language. The following are some of the differences: Data Type Changes The .NET platform provides Common Type System to all the supported languages. This means that all the languages must support the same data types as enforced by common language runtime. This eliminates data type incompatibilities between various languages. For example on the 32-bit Windows platform, the integer data type takes 4 bytes in languages like C++ whereas in VB it takes 2 bytes. Following are the main changes related to data types in VB.NET: . Under .NET the integer data type in VB.NET is also 4 bytes in size. . VB.NET has no currency data type. Instead it provides decimal as a replacement. . VB.NET introduces a new data type called Char. The char data type takes 2 bytes and can store Unicode characters. . VB.NET do not have Variant data type. To achieve a result similar to variant type you can use Object data type. (Since every thing in .NET including primitive data types is an object, a variable of object type can point to any data type). . In VB.NET there is no concept of fixed length strings. . In VB6 we used the Type keyword to declare our user-defined structures. VB.NET introduces the structure keyword for the same purpose. Declaring Variables Consider this simple example in VB6: Dim x,y as integer In this example VB6 will consider x as variant and y as integer, which is somewhat odd behavior. VB.NET corrects this problem, creating both x and y as integers. Furthermore, VB.NET allows you to assign initial values to the variables in the declaration statement itself: br> Dim str1 as string = Hello VB.NET also introduces Read-Only variables. Unlike constants Read-Only variables can be declared without initialization but once you assign a value to it, it cannot be changes. Initialization here Dim readonly x as integer In later code X=100 Now x can’t be changed X=200 *********** Error ********** Property Syntax In VB.NET, we anymore don't have separate declarations for Get and Set/Let. Now, everything is done in a single property declaration. This can be better explained by the following example. Public [ReadOnly | WriteOnly] Property PropertyName as Datatype Get Return m_var End Get Set M_var = value End Set End Property Example: Private _message as String Public Property Message As String Get Return _message End Get Set _message = Value End Set End Property ByVal is the default - This is a crucial difference betwen VB 6.0 and V

        A Offline
        A Offline
        Ashfield
        wrote on last edited by
        #3

        And your point is?

        Bob Ashfield Consultants Ltd

        1 Reply Last reply
        0
        • S Sarfraz Munna

          Now VB.NET is object-oriented language. The following are some of the differences: Data Type Changes The .NET platform provides Common Type System to all the supported languages. This means that all the languages must support the same data types as enforced by common language runtime. This eliminates data type incompatibilities between various languages. For example on the 32-bit Windows platform, the integer data type takes 4 bytes in languages like C++ whereas in VB it takes 2 bytes. Following are the main changes related to data types in VB.NET: . Under .NET the integer data type in VB.NET is also 4 bytes in size. . VB.NET has no currency data type. Instead it provides decimal as a replacement. . VB.NET introduces a new data type called Char. The char data type takes 2 bytes and can store Unicode characters. . VB.NET do not have Variant data type. To achieve a result similar to variant type you can use Object data type. (Since every thing in .NET including primitive data types is an object, a variable of object type can point to any data type). . In VB.NET there is no concept of fixed length strings. . In VB6 we used the Type keyword to declare our user-defined structures. VB.NET introduces the structure keyword for the same purpose. Declaring Variables Consider this simple example in VB6: Dim x,y as integer In this example VB6 will consider x as variant and y as integer, which is somewhat odd behavior. VB.NET corrects this problem, creating both x and y as integers. Furthermore, VB.NET allows you to assign initial values to the variables in the declaration statement itself: br> Dim str1 as string = Hello VB.NET also introduces Read-Only variables. Unlike constants Read-Only variables can be declared without initialization but once you assign a value to it, it cannot be changes. Initialization here Dim readonly x as integer In later code X=100 Now x can’t be changed X=200 *********** Error ********** Property Syntax In VB.NET, we anymore don't have separate declarations for Get and Set/Let. Now, everything is done in a single property declaration. This can be better explained by the following example. Public [ReadOnly | WriteOnly] Property PropertyName as Datatype Get Return m_var End Get Set M_var = value End Set End Property Example: Private _message as String Public Property Message As String Get Return _message End Get Set _message = Value End Set End Property ByVal is the default - This is a crucial difference betwen VB 6.0 and V

          C Offline
          C Offline
          Christian Graus
          wrote on last edited by
          #4

          Wow - I've seen people write questions in articles, now it's articles in forums. The answer is much shorter - VB6 is rubbish, and VB.NET is a real language.

          Christian Graus Please read this if you don't understand the answer I've given you "also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )

          H 1 Reply Last reply
          0
          • S Sarfraz Munna

            Now VB.NET is object-oriented language. The following are some of the differences: Data Type Changes The .NET platform provides Common Type System to all the supported languages. This means that all the languages must support the same data types as enforced by common language runtime. This eliminates data type incompatibilities between various languages. For example on the 32-bit Windows platform, the integer data type takes 4 bytes in languages like C++ whereas in VB it takes 2 bytes. Following are the main changes related to data types in VB.NET: . Under .NET the integer data type in VB.NET is also 4 bytes in size. . VB.NET has no currency data type. Instead it provides decimal as a replacement. . VB.NET introduces a new data type called Char. The char data type takes 2 bytes and can store Unicode characters. . VB.NET do not have Variant data type. To achieve a result similar to variant type you can use Object data type. (Since every thing in .NET including primitive data types is an object, a variable of object type can point to any data type). . In VB.NET there is no concept of fixed length strings. . In VB6 we used the Type keyword to declare our user-defined structures. VB.NET introduces the structure keyword for the same purpose. Declaring Variables Consider this simple example in VB6: Dim x,y as integer In this example VB6 will consider x as variant and y as integer, which is somewhat odd behavior. VB.NET corrects this problem, creating both x and y as integers. Furthermore, VB.NET allows you to assign initial values to the variables in the declaration statement itself: br> Dim str1 as string = Hello VB.NET also introduces Read-Only variables. Unlike constants Read-Only variables can be declared without initialization but once you assign a value to it, it cannot be changes. Initialization here Dim readonly x as integer In later code X=100 Now x can’t be changed X=200 *********** Error ********** Property Syntax In VB.NET, we anymore don't have separate declarations for Get and Set/Let. Now, everything is done in a single property declaration. This can be better explained by the following example. Public [ReadOnly | WriteOnly] Property PropertyName as Datatype Get Return m_var End Get Set M_var = value End Set End Property Example: Private _message as String Public Property Message As String Get Return _message End Get Set _message = Value End Set End Property ByVal is the default - This is a crucial difference betwen VB 6.0 and V

            S Offline
            S Offline
            supercat9
            wrote on last edited by
            #5

            Munna Sarfraz Ahmad wrote:

            But objects are still passed by reference.

            Not quite. Consider the following:

            public sub sub1(byref x as collection)
            x.add(45)
            x=new collection
            x.add(23)
            end sub

            public sub sub2(byval x as collection)
            x.add(45)
            x=new collection
            x.add(23)
            end sub

            If 'x' is a collection, and I perform sub1(x), then x will now point to a new collection containing the value 23. If a reference to the old collection exists anywhere, the collection pointed to by that reference will now have contain the value 45. If x was the only reference to that collection, it will go bye-bye. In the second scenario, when I perform sub2(x), then the collection pointed to by 'x' will have whatever it had in it before, along with 45. A new collection will be created and have 23 put into it, but that collection will go bye-bye sometime after the function exits.

            K 1 Reply Last reply
            0
            • S supercat9

              Munna Sarfraz Ahmad wrote:

              But objects are still passed by reference.

              Not quite. Consider the following:

              public sub sub1(byref x as collection)
              x.add(45)
              x=new collection
              x.add(23)
              end sub

              public sub sub2(byval x as collection)
              x.add(45)
              x=new collection
              x.add(23)
              end sub

              If 'x' is a collection, and I perform sub1(x), then x will now point to a new collection containing the value 23. If a reference to the old collection exists anywhere, the collection pointed to by that reference will now have contain the value 45. If x was the only reference to that collection, it will go bye-bye. In the second scenario, when I perform sub2(x), then the collection pointed to by 'x' will have whatever it had in it before, along with 45. A new collection will be created and have 23 put into it, but that collection will go bye-bye sometime after the function exits.

              K Offline
              K Offline
              Kevin Brydon
              wrote on last edited by
              #6

              i cant believe you bothered to read that!

              1 Reply Last reply
              0
              • S Sarfraz Munna

                Now VB.NET is object-oriented language. The following are some of the differences: Data Type Changes The .NET platform provides Common Type System to all the supported languages. This means that all the languages must support the same data types as enforced by common language runtime. This eliminates data type incompatibilities between various languages. For example on the 32-bit Windows platform, the integer data type takes 4 bytes in languages like C++ whereas in VB it takes 2 bytes. Following are the main changes related to data types in VB.NET: . Under .NET the integer data type in VB.NET is also 4 bytes in size. . VB.NET has no currency data type. Instead it provides decimal as a replacement. . VB.NET introduces a new data type called Char. The char data type takes 2 bytes and can store Unicode characters. . VB.NET do not have Variant data type. To achieve a result similar to variant type you can use Object data type. (Since every thing in .NET including primitive data types is an object, a variable of object type can point to any data type). . In VB.NET there is no concept of fixed length strings. . In VB6 we used the Type keyword to declare our user-defined structures. VB.NET introduces the structure keyword for the same purpose. Declaring Variables Consider this simple example in VB6: Dim x,y as integer In this example VB6 will consider x as variant and y as integer, which is somewhat odd behavior. VB.NET corrects this problem, creating both x and y as integers. Furthermore, VB.NET allows you to assign initial values to the variables in the declaration statement itself: br> Dim str1 as string = Hello VB.NET also introduces Read-Only variables. Unlike constants Read-Only variables can be declared without initialization but once you assign a value to it, it cannot be changes. Initialization here Dim readonly x as integer In later code X=100 Now x can’t be changed X=200 *********** Error ********** Property Syntax In VB.NET, we anymore don't have separate declarations for Get and Set/Let. Now, everything is done in a single property declaration. This can be better explained by the following example. Public [ReadOnly | WriteOnly] Property PropertyName as Datatype Get Return m_var End Get Set M_var = value End Set End Property Example: Private _message as String Public Property Message As String Get Return _message End Get Set _message = Value End Set End Property ByVal is the default - This is a crucial difference betwen VB 6.0 and V

                G Offline
                G Offline
                Guffa
                wrote on last edited by
                #7

                Munna Sarfraz Ahmad wrote:

                The keyword SET is gone - Since everything in VB.NET is an object.

                No, that's not the reason, because that is not true. There is still a difference between simple variables (value types) and objects (reference types). A reference is however a value type, so whenever you make an assignment, you are copying a value type. As you can't assign the object itself, there is no use for the Set keyword.

                Munna Sarfraz Ahmad wrote:

                We can also create a class destructor, which is equivalent to Class_Terminate event in VB 6.0, by adding a sub-procedure called Finalize to our class.

                The memory management in .NET doesn't use reference counting, so the Finalize method is not a destructor. It's not equivalent to the Class_Terminate event. If you need to control the life cycle of an object, the class should implement the IDisposable interface.

                Despite everything, the person most likely to be fooling you next is yourself.

                1 Reply Last reply
                0
                • C Christian Graus

                  Wow - I've seen people write questions in articles, now it's articles in forums. The answer is much shorter - VB6 is rubbish, and VB.NET is a real language.

                  Christian Graus Please read this if you don't understand the answer I've given you "also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )

                  H Offline
                  H Offline
                  Herl the Pearl
                  wrote on last edited by
                  #8

                  VB6 is great --- VB.Net is just greater. :-D

                  Ask not whether it is useful. Ask what it is useful for.

                  1 Reply Last reply
                  0
                  Reply
                  • Reply as topic
                  Log in to reply
                  • Oldest to Newest
                  • Newest to Oldest
                  • Most Votes


                  • Login

                  • Don't have an account? Register

                  • Login or register to search.
                  • First post
                    Last post
                  0
                  • Categories
                  • Recent
                  • Tags
                  • Popular
                  • World
                  • Users
                  • Groups