Valhalla Legends Forums Archive | .NET Platform | Visual Basic . NET

AuthorMessageTime
bRoKeN
Okay, well i was going to start by learning Visual Basic and i went to the book store and baught a book but it seems to teach Visual Basic . NET. I just wanted to know is VB and VB.NEt = same thing or like if i learn VB.NET i can work with VB also? And what's the diffecrence.
February 22, 2004, 1:49 AM
hismajesty
They are very different in my opinion.
February 22, 2004, 12:14 PM
bRoKeN
I was told its more advanced, For advanced programming.
February 22, 2004, 2:43 PM
DaRk-FeAnOr
Visual Basic .NET is basically a more object oriented version of Visual Basic 6. If you know one of them, you could probably program in the other without really having to learn anything new.
February 23, 2004, 5:28 PM
Myndfyr
[quote author=DaRk-FeAnOr link=board=37;threadid=5397;start=0#msg45589 date=1077557302]
Visual Basic .NET is basically a more object oriented version of Visual Basic 6. If you know one of them, you could probably program in the other without really having to learn anything new.
[/quote]

This is correct. As a matter of fact, it's quite easy to learn VB 6 once knowing a .NET language (I went from JavaScript to JScript.NET to C# to VB .NET to VB 6).
February 23, 2004, 11:25 PM
Adron
[quote author=Myndfyre link=board=37;threadid=5397;start=0#msg45648 date=1077578705]
This is correct. As a matter of fact, it's quite easy to learn VB 6 once knowing a .NET language (I went from JavaScript to JScript.NET to C# to VB .NET to VB 6).
[/quote]

Are you generally backwards? :P
February 23, 2004, 11:33 PM
K
[quote author=Myndfyre link=board=37;threadid=5397;start=0#msg45648 date=1077578705]
[quote author=DaRk-FeAnOr link=board=37;threadid=5397;start=0#msg45589 date=1077557302]
Visual Basic .NET is basically a more object oriented version of Visual Basic 6. If you know one of them, you could probably program in the other without really having to learn anything new.
[/quote]

This is correct. As a matter of fact, it's quite easy to learn VB 6 once knowing a .NET language (I went from JavaScript to JScript.NET to C# to VB .NET to VB 6).
[/quote]

I will stick to the stance that going from VB6 to a .NET is more difficult. You are more likely to use legacy functions from the Microsoft.VisualBasic namespace than the more object oriented System.* namespaces - for example Open / Print / Close for file IO instead of using a System.IO.Filestream, InStr() instead of String.IndexOf(), Mid$() instead of String.Substring(). You get the picture. VB.NET lets you do a lot of things not standard to the CLR in the name of compatability (globule modules ...)

Sure, youre code will work, but it's kind of like writing C code in C++.
February 23, 2004, 11:39 PM
Grok
In my VB.NET and ASP.NET projects, I still write code with VB6 keywords, methods, properties. It will take more time and experience to write VB.NET the way it was intended.
February 23, 2004, 11:48 PM
Adron
[quote author=K link=board=37;threadid=5397;start=0#msg45651 date=1077579543]
Sure, youre code will work, but it's kind of like writing C code in C++.
[/quote]

I use strcpy, memcpy & co a lot in C++ code actually. And besides, Mid is shorter than Substring and InStr is shorter than IndexOf, so they're more efficient to use.
February 24, 2004, 12:06 AM
K
[quote author=Grok link=board=37;threadid=5397;start=0#msg45653 date=1077580088]
In my VB.NET and ASP.NET projects, I still write code with VB6 keywords, methods, properties. It will take more time and experience to write VB.NET the way it was intended.
[/quote]

Exactly what I'm saying.

[quote author=Adron link=board=37;threadid=5397;start=0#msg45659 date=1077581208]
[quote author=K link=board=37;threadid=5397;start=0#msg45651 date=1077579543]
Sure, youre code will work, but it's kind of like writing C code in C++.
[/quote]

I use strcpy, memcpy & co a lot in C++ code actually. And besides, Mid is shorter than Substring and InStr is shorter than IndexOf, so they're more efficient to use.
[/quote]

Ok, so maybe my analogy was flawed ::)
Do you write code like this in C++ projects?
[code]void rbtree_init(Node* root);
void rbtree_destroy(Node* root);
void rbtree_fixup(Node* x);
Node* rbtree_find(int key);
void rbtree_insert(int key);[/code]

February 24, 2004, 12:57 AM
Adron
Hmm, no, I'd probably use a class for that particular case. But I do use printf type functions in C++. Another example of using "legacy" functions...
February 24, 2004, 10:38 PM
peofeoknight
VB6 and vb.net are very similar the majority of the time syntax wise. But vb.net offers a butt load more power then vb6 when you get into the meat of it. I went striaght from vb6 to vb.net with ease. I have been using asp.net for about a year and find vb.net much easier to use then vb6. When you say vb.net is much more object oritned then vb6 it is an under statement, vb.net is completly object oriented, where as it would almost be a joke to call vb6 the least bit object oriented.
February 25, 2004, 1:00 AM
DaRk-FeAnOr
[quote author=K link=board=37;threadid=5397;start=0#msg45651 date=1077579543]
I will stick to the stance that going from VB6 to a .NET is more difficult.
[/quote]
Not if you already understand OO programming.
February 25, 2004, 1:31 AM
peofeoknight
[quote author=DaRk-FeAnOr link=board=37;threadid=5397;start=0#msg45890 date=1077672675]
[quote author=K link=board=37;threadid=5397;start=0#msg45651 date=1077579543]
I will stick to the stance that going from VB6 to a .NET is more difficult.
[/quote]
Not if you already understand OO programming.
[/quote]yes you can do everything in vb.net you can do in vb6 with the same or greater ease. You do not even need to fully understand OO to use vb.net, but eventually it will come in handy.
February 25, 2004, 1:54 AM
Myndfyr
[quote author=Adron link=board=37;threadid=5397;start=0#msg45649 date=1077579208]
[quote author=Myndfyre link=board=37;threadid=5397;start=0#msg45648 date=1077578705]
This is correct. As a matter of fact, it's quite easy to learn VB 6 once knowing a .NET language (I went from JavaScript to JScript.NET to C# to VB .NET to VB 6).
[/quote]

Are you generally backwards? :P
[/quote]

hehe, no. I learned JavaScript first because it is a client-side web language. Then I went to JScript.NET when I got into server-side junk. C# was being touted by Microsoft for the .NET platform so I picked that up, and once I had that, VB .NET was a breeze. Having been looking at code samples, all the other VB-centric stuff (such as vbCrLf and vbRed, all that fun junk) was easy to pick up for VB6. :p
February 27, 2004, 4:18 AM
Grok
VB.NET makes such prettier code than VB6.

[code]
'see if document has correct properties
Dim kfDoc As AKO32.CDocument = New AKO32.CDocument
kfDoc.hKGI = KGI
kfDoc.OpenDocument(Doc.docid)
Dim result As Integer = 0
result = IIf(Len(Doc.title) = 0, 0, Math.Abs([String].Compare(Doc.title, kfDoc.Title)))
result += IIf(Len(Doc.person) = 0, 0, Math.Abs([String].Compare(Doc.person, kfDoc.Person)))
result += IIf(Len(Doc.type) = 0, 0, Math.Abs([String].Compare(Doc.type, kfDoc.UserType)))
result += IIf(Len(Doc.kfdate) = 0, 0, Math.Abs([String].Compare(Doc.kfdate, kfDoc.DateCreated)))
result += IIf(Len(Doc.description) = 0, 0, Math.Abs([String].Compare(Doc.description, kfDoc.Description)))
result += IIf(Len(Doc.kfgroup) = 0, 0, Math.Abs([String].Compare(Doc.kfgroup, kfDoc.Group)))
result += IIf(Len(Doc.subclass) = 0, 0, Math.Abs([String].Compare(Doc.subclass, kfDoc.Subclass)))
If result = 0 Then 'so far so good, check keywords
Dim kw() As String = Split(kfDoc.UserKeywords, vbCrLf)
Dim lPos As Integer
For lPos = 1 To UBound(kw) + 1
Select Case lPos
Case 1 : result += IIf(Len(Doc.keywords1) = 0, 0, Math.Abs([String].Compare(Doc.keywords1, kw(lPos - 1))))
Case 2 : result += IIf(Len(Doc.keywords2) = 0, 0, Math.Abs([String].Compare(Doc.keywords2, kw(lPos - 1))))
Case 3 : result += IIf(Len(Doc.keywords3) = 0, 0, Math.Abs([String].Compare(Doc.keywords3, kw(lPos - 1))))
Case 4 : result += IIf(Len(Doc.keywords4) = 0, 0, Math.Abs([String].Compare(Doc.keywords4, kw(lPos - 1))))
Case 5 : result += IIf(Len(Doc.keywords5) = 0, 0, Math.Abs([String].Compare(Doc.keywords5, kw(lPos - 1))))
Case 6 : result += IIf(Len(Doc.keywords6) = 0, 0, Math.Abs([String].Compare(Doc.keywords6, kw(lPos - 1))))
Case 7 : result += IIf(Len(Doc.keywords7) = 0, 0, Math.Abs([String].Compare(Doc.keywords7, kw(lPos - 1))))
Case 8 : result += IIf(Len(Doc.keywords8) = 0, 0, Math.Abs([String].Compare(Doc.keywords8, kw(lPos - 1))))
Case 9 : result += IIf(Len(Doc.keywords9) = 0, 0, Math.Abs([String].Compare(Doc.keywords9, kw(lPos - 1))))
End Select
Next lPos
End If

'see if docid is contained in destination container id
result += IIf(KGI.IsContainedIn(Doc.docid, Doc.destid), 0, 1)

If result = 0 Then
'all is well, update status ...
[/code]
March 2, 2004, 11:04 PM
peofeoknight
[quote author=Grok link=board=37;threadid=5397;start=15#msg47136 date=1078268698]
VB.NET makes such prettier code than VB6.
[/quote]I aggree. Its the little things that have evolved in the syntax that make the codeing so much easier.
March 4, 2004, 10:58 PM
Adron
Did they fix the IIf operator to only evaluate one of the expressions, and did they fix boolean logic to be short-circuited?
March 4, 2004, 11:52 PM
St0rm.iD
[quote author=peofeoknight link=board=37;threadid=5397;start=15#msg47484 date=1078441133]
[quote author=Grok link=board=37;threadid=5397;start=15#msg47136 date=1078268698]
VB.NET makes such prettier code than VB6.
[/quote]I aggree. Its the little things that have evolved in the syntax that make the codeing so much easier.
[/quote]
I think he was being sarcastic.
March 5, 2004, 12:02 AM
Grok
Still ewwy.

[quote]As part of preparing the argument list for the call to IIf, the Visual Basic compiler calls every function in every expression. [/quote]
March 5, 2004, 12:06 AM
Adron
And what about boolean logic?
March 5, 2004, 2:12 AM
peofeoknight
[quote author=St0rm.iD link=board=37;threadid=5397;start=15#msg47513 date=1078444960]
[quote author=peofeoknight link=board=37;threadid=5397;start=15#msg47484 date=1078441133]
[quote author=Grok link=board=37;threadid=5397;start=15#msg47136 date=1078268698]
VB.NET makes such prettier code than VB6.
[/quote]I aggree. Its the little things that have evolved in the syntax that make the codeing so much easier.
[/quote]
I think he was being sarcastic.
[/quote]But I wasn't :P
March 5, 2004, 4:53 AM
Grok
[quote author=Adron link=board=37;threadid=5397;start=15#msg47557 date=1078452754]
And what about boolean logic?
[/quote]

I don't know of an obvious way to test that. Maybe

x = 0 and (side_effect_function(z))

and see if the side effect happens?
March 5, 2004, 12:00 PM
Adron
[quote author=Grok link=board=37;threadid=5397;start=15#msg47617 date=1078488036]
I don't know of an obvious way to test that. Maybe

x = 0 and (side_effect_function(z))

and see if the side effect happens?
[/quote]

A typical example of when I'd want it to be short-circuited is for testing fields of a recordset like this:

[code]
If Not IsNull(rs!field) And rs!field = "something" Then
[/code]

If it is short-circuited, rs!field = "something" won't be evaluated, and you won't get a run-time error.

Another example is:

[code]
If y <> 0 And x/y > 12 Then
[/code]
March 5, 2004, 5:50 PM
Myndfyr
Looks like Adron's been left hanging here...

.NET evaluates boolean expressions the same way across all languages.

Your example

[code]

If x = 0 And SideEffectFunction(z)

[/code]

would not call SideEffectFunction() if x was not 0.

The example

[code]
If Not IsNull(rs!field) And rs!field = "something" Then
[/code]

would not use the comparison of rs!field to "something" if the first condition failed.

Cheers.
March 22, 2004, 6:29 AM
Adron
Ah, neat!

That's something that has annoyed me for a long time in VB.
March 22, 2004, 10:29 AM
peofeoknight
its just like any other language in any other scripting I mean if the first part of an and is false the comp just stops right there. Its the same in c++, the same in c, the same in java.
March 22, 2004, 10:13 PM
Adron
[quote author=peofeoknight link=board=37;threadid=5397;start=15#msg50975 date=1079993611]
its just like any other language in any other scripting I mean if the first part of an and is false the comp just stops right there. Its the same in c++, the same in c, the same in java.
[/quote]

But different in VB.
March 22, 2004, 10:18 PM
peofeoknight
I dont know about vb6... but vb.net is just like the other scripting languages.
March 22, 2004, 10:19 PM
Myndfyr
[quote author=peofeoknight link=board=37;threadid=5397;start=15#msg50980 date=1079993999]
I dont know about vb6... but vb.net is just like the other scripting languages.
[/quote]

uhh, no. VB .NET is not even a scripting language! You might be thinking of VBA (Visual Basic for Applications) or VBScript, but Visual Basic .NET is not a scripting language.

Its late binding features allow it to be used in a scripting environment, such as the dead-and-nearly-forgotten Visual Studio for Applications (Microsoft.Vsa namespace), but even that code is compiled, not interpreted.
March 22, 2004, 10:46 PM
peofeoknight
would you consider vb to be a scripting language then? vb.net can be used to make executable programs. I would consider php to be a scripting language though it is only use to make dynamic web sites.
March 22, 2004, 11:10 PM
Myndfyr
[quote author=peofeoknight link=board=37;threadid=5397;start=30#msg51001 date=1079997018]
would you consider vb to be a scripting language then? vb.net can be used to make executable programs. I would consider php to be a scripting language though it is only use to make dynamic web sites.
[/quote]

No. Visual Basic is a compiled language; VBScript (Visual Basic Scripting Edition) is an interpreted language. Visual Basic .NET is a compiled language; PHP is an interpreted language.

JavaScript/JScript is an interpreted language. JScript .NET is a compiled language. Despite its name, JScript .NET is no longer a scripting language; by Microsoft's own statements, it no longer is a scripting language, but rather a full object-oriented language with a "scripting feel."
March 23, 2004, 12:13 AM
peofeoknight
so java could be either or depending on how it is used?
March 23, 2004, 1:43 AM

Search