By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
457,949 Members | 1,511 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 457,949 IT Pros & Developers. It's quick & easy.

Interesting VB.NET Intellisense

P: n/a
Hi,

Seems like VB.NET Intellisense and complier does check for method
definitions much. The following code compiles with no errors in VB.NET! (but
of course, trust C# to be strict and perfect :) )

[c#]
public class MyOwnClass
{
public void Print()
{
Console.WriteLine("Print");
}
}

static void Main(string[] args)
{
object myObj = new MyOwnClass();
myObj.Print();
}

[VB.NET]
Public Class MyOwnClass
Public Sub Print()
Console.WriteLine("Print")
End Sub
End Class

Module Module1

Sub Main()
Dim myObject As Object = New MyOwnClass
myObject.Print()
End Sub

End Module

I believe i read somehere about VB being dynamin binding or
something....dunno whether this is something to do with it.

--
Rakesh Rajan
Jul 21 '05 #1
Share this Question
Share on Google+
10 Replies


P: n/a
Sorry...i meant "Seems like VB.NET Intellisense and complier does NOT check
for method definitions much. The following code compiles with no errors in
VB.NET!"....missed a NOT :)

"

"Rakesh Rajan" wrote:
Hi,

Seems like VB.NET Intellisense and complier does check for method
definitions much. The following code compiles with no errors in VB.NET! (but
of course, trust C# to be strict and perfect :) )

[c#]
public class MyOwnClass
{
public void Print()
{
Console.WriteLine("Print");
}
}

static void Main(string[] args)
{
object myObj = new MyOwnClass();
myObj.Print();
}

[VB.NET]
Public Class MyOwnClass
Public Sub Print()
Console.WriteLine("Print")
End Sub
End Class

Module Module1

Sub Main()
Dim myObject As Object = New MyOwnClass
myObject.Print()
End Sub

End Module

I believe i read somehere about VB being dynamin binding or
something....dunno whether this is something to do with it.

--
Rakesh Rajan

Jul 21 '05 #2

P: n/a
Rakesh,

This is something the people who use VBNet do hate in C#, it has many legacy
restrictions from C and that is needed because it does not use intellisense
in the IDE which can help the programmer with the exeption than that C# is
showing some more information (wherefore is the documenter which is not in
VBNet until 2005).

In VBNet does "object.whatever" mean by default "object.whatever()" what it
would be in classic C. What can it be else, however it is checked with
background compiling by the IDE in VBNet, a feature that does not exist in
C#.

When you are talking about binding, than has VBNet two possibilities, with
late binding and early binding.

Late binding can be very effective for modeling however not good for real
production software because it can give unpredicted errors. It is easy to
set in VBNet as a option in the IDE to use always option strict on, and than
it is exactly the same as with C#.

I hope this gives some idea's

(When you translate a language by the way, do than not use the style of code
you are used to by your regular code, the sample you showed from VBNet would
be made by a VBNet programmer much simpler).

Cor
Jul 21 '05 #3

P: n/a
Are you a VB.NETter? ;)
In VBNet does "object.whatever" mean by default "object.whatever()" what it
would be in classic C. What can it be else, however it is checked with
background compiling by the IDE in VBNet, a feature that does not exist in
C#.

I don't understand how this feature could be useful - won't this result in
errors that could be easily prevented? For example, if someone misspells a
method name in VB.NET - this would create a run-time exception, whereas this
would be caught @ compile time in C# (much better).

Jul 21 '05 #4

P: n/a
I don't understand how this feature could be useful - won't this result in
errors that could be easily prevented? For example, if someone misspells a
method name in VB.NET - this would create a run-time exception, whereas this would be caught @ compile time in C# (much better).


The errors are catched when typing in the IDE directly with VBNet, The VBNet
IDE corrects as well by instance although not directly needed as well all
cases.

There is one argument that this is not a good method; This checking while
typing cost time, so especially on more older computers the C# way of doing
it is than better.

I hope this makes it even more clear.

For me is this a major reason why I am a VBNetter yes. The language
differences itself are very fair and are not a reason for me.

Cor
Jul 21 '05 #5

P: n/a
I'm a VB.NETter too. I have done some programming in C# but much prefer the
forgiveability (that might not be a real word) of VB. If I misspell a method
then VB will complain to me that the method does not exist. This is because
I have Option Strict On and Option Explicit On.

If I make a mistake in VB the IDE tells me immediately, C# waits for me to
Build.

Now the main reason that I prefer VB is that it is not case sensitive.
mymethod is exactly the same as myMethod and the IDE will automagically
correct the case for me. C# does not and so I have to spend too much time
correcting case (I'm not a touch typist so I look at the keyboard not the
screen).
If I have 2 different variables/methods I would choose to give them
different names rather than different case, since I find it is much easier
to read back.

What's the difference between myvar, myVar and MyVar? Which one am I
referring to in myMethod? Did I really mean to use MyVar when I used myVar?
It may compile just fine but will give me an error which may be hard to
trace. This is the reason that i would not declare variables using
differering case and so I immediately lose the benefit of Case Sensitivity.

There are things about C# that I do like, but overall I much prefer VB.

--
Mick Doherty
http://dotnetrix.co.uk/nothing.html
"Rakesh Rajan" <Ra*********@discussions.microsoft.com> wrote in message
news:01**********************************@microsof t.com...
Are you a VB.NETter? ;)
In VBNet does "object.whatever" mean by default "object.whatever()" what
it
would be in classic C. What can it be else, however it is checked with
background compiling by the IDE in VBNet, a feature that does not exist
in
C#.

I don't understand how this feature could be useful - won't this result in
errors that could be easily prevented? For example, if someone misspells a
method name in VB.NET - this would create a run-time exception, whereas
this
would be caught @ compile time in C# (much better).

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.742 / Virus Database: 495 - Release Date: 19/08/2004
Jul 21 '05 #6

P: n/a
All you said are very much true...but I must say that C# is more OOPs-like,
and that makes a significant difference....hmm...is this thread yet another
beginning of the 'language wars'? ;)

"Mick Doherty" wrote:
I'm a VB.NETter too. I have done some programming in C# but much prefer the
forgiveability (that might not be a real word) of VB. If I misspell a method
then VB will complain to me that the method does not exist. This is because
I have Option Strict On and Option Explicit On.

If I make a mistake in VB the IDE tells me immediately, C# waits for me to
Build.

Now the main reason that I prefer VB is that it is not case sensitive.
mymethod is exactly the same as myMethod and the IDE will automagically
correct the case for me. C# does not and so I have to spend too much time
correcting case (I'm not a touch typist so I look at the keyboard not the
screen).
If I have 2 different variables/methods I would choose to give them
different names rather than different case, since I find it is much easier
to read back.

What's the difference between myvar, myVar and MyVar? Which one am I
referring to in myMethod? Did I really mean to use MyVar when I used myVar?
It may compile just fine but will give me an error which may be hard to
trace. This is the reason that i would not declare variables using
differering case and so I immediately lose the benefit of Case Sensitivity.

There are things about C# that I do like, but overall I much prefer VB.

--
Mick Doherty
http://dotnetrix.co.uk/nothing.html
"Rakesh Rajan" <Ra*********@discussions.microsoft.com> wrote in message
news:01**********************************@microsof t.com...
Are you a VB.NETter? ;)
In VBNet does "object.whatever" mean by default "object.whatever()" what
it
would be in classic C. What can it be else, however it is checked with
background compiling by the IDE in VBNet, a feature that does not exist
in
C#.

I don't understand how this feature could be useful - won't this result in
errors that could be easily prevented? For example, if someone misspells a
method name in VB.NET - this would create a run-time exception, whereas
this
would be caught @ compile time in C# (much better).

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.742 / Virus Database: 495 - Release Date: 19/08/2004

Jul 21 '05 #7

P: n/a
All you said are very much true...but I must say that C# is more OOPs-like, and that makes a significant difference...


Why just give some examples,

This is not a war however I was almost sure you was missing that part of the
checking of typing in VBNet so that I tried to explain for you.

The first time I used C# (I started with VBNet) I was expecting that it was
there as well. So probably your starting message was because you did not
know that this was in VBNet.

However explain to use why in your opinion C# is more OOP than VBNet, I am
currious about it because it is really again an message we see seldom in
this dotNet newsgroups, even not when people are telling why the one
language is better than the other (what I do not, I am only talking about
the IDE which I prefer).

Cor

Jul 21 '05 #8

P: n/a
How is it more OOP like?
I don't believe that VB is better than C# or vice versa, I just much prefer
VB. Maybe I am swayed by my VBClassic background, but I don't think so.

--
Mick Doherty
http://dotnetrix.co.uk/nothing.html
"Rakesh Rajan" <Ra*********@discussions.microsoft.com> wrote in message
news:1C**********************************@microsof t.com...
All you said are very much true...but I must say that C# is more
OOPs-like,
and that makes a significant difference....hmm...is this thread yet
another
beginning of the 'language wars'? ;)

"Mick Doherty" wrote:
I'm a VB.NETter too. I have done some programming in C# but much prefer
the
forgiveability (that might not be a real word) of VB. If I misspell a
method
then VB will complain to me that the method does not exist. This is
because
I have Option Strict On and Option Explicit On.

If I make a mistake in VB the IDE tells me immediately, C# waits for me
to
Build.

Now the main reason that I prefer VB is that it is not case sensitive.
mymethod is exactly the same as myMethod and the IDE will automagically
correct the case for me. C# does not and so I have to spend too much time
correcting case (I'm not a touch typist so I look at the keyboard not the
screen).
If I have 2 different variables/methods I would choose to give them
different names rather than different case, since I find it is much
easier
to read back.

What's the difference between myvar, myVar and MyVar? Which one am I
referring to in myMethod? Did I really mean to use MyVar when I used
myVar?
It may compile just fine but will give me an error which may be hard to
trace. This is the reason that i would not declare variables using
differering case and so I immediately lose the benefit of Case
Sensitivity.

There are things about C# that I do like, but overall I much prefer VB.

--
Mick Doherty
http://dotnetrix.co.uk/nothing.html
"Rakesh Rajan" <Ra*********@discussions.microsoft.com> wrote in message
news:01**********************************@microsof t.com...
> Are you a VB.NETter? ;)
>
>> In VBNet does "object.whatever" mean by default "object.whatever()"
>> what
>> it
>> would be in classic C. What can it be else, however it is checked with
>> background compiling by the IDE in VBNet, a feature that does not
>> exist
>> in
>> C#.
> I don't understand how this feature could be useful - won't this result
> in
> errors that could be easily prevented? For example, if someone
> misspells a
> method name in VB.NET - this would create a run-time exception, whereas
> this
> would be caught @ compile time in C# (much better).
>

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.742 / Virus Database: 495 - Release Date: 19/08/2004

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.742 / Virus Database: 495 - Release Date: 19/08/2004
Jul 21 '05 #9

P: n/a
Cor and Mick,

I feel it's more OOPs like because OOPs started with c++ and c# derives it's
most of it's syntax from c++ and java...most of the keywords map directly
with what OOPs states....with VB.NET, i feel it's more like an 'add-on' to an
existing set of keywords, rather than pure thing u know...

The point i want to bring here is that as C# was developed from scratch
based on OOPs and all, it's seeminlgy very usable.

Don't you feel so?

Rakesh

"Mick Doherty" wrote:
How is it more OOP like?
I don't believe that VB is better than C# or vice versa, I just much prefer
VB. Maybe I am swayed by my VBClassic background, but I don't think so.

--
Mick Doherty
http://dotnetrix.co.uk/nothing.html
"Rakesh Rajan" <Ra*********@discussions.microsoft.com> wrote in message
news:1C**********************************@microsof t.com...
All you said are very much true...but I must say that C# is more
OOPs-like,
and that makes a significant difference....hmm...is this thread yet
another
beginning of the 'language wars'? ;)

"Mick Doherty" wrote:
I'm a VB.NETter too. I have done some programming in C# but much prefer
the
forgiveability (that might not be a real word) of VB. If I misspell a
method
then VB will complain to me that the method does not exist. This is
because
I have Option Strict On and Option Explicit On.

If I make a mistake in VB the IDE tells me immediately, C# waits for me
to
Build.

Now the main reason that I prefer VB is that it is not case sensitive.
mymethod is exactly the same as myMethod and the IDE will automagically
correct the case for me. C# does not and so I have to spend too much time
correcting case (I'm not a touch typist so I look at the keyboard not the
screen).
If I have 2 different variables/methods I would choose to give them
different names rather than different case, since I find it is much
easier
to read back.

What's the difference between myvar, myVar and MyVar? Which one am I
referring to in myMethod? Did I really mean to use MyVar when I used
myVar?
It may compile just fine but will give me an error which may be hard to
trace. This is the reason that i would not declare variables using
differering case and so I immediately lose the benefit of Case
Sensitivity.

There are things about C# that I do like, but overall I much prefer VB.

--
Mick Doherty
http://dotnetrix.co.uk/nothing.html
"Rakesh Rajan" <Ra*********@discussions.microsoft.com> wrote in message
news:01**********************************@microsof t.com...
> Are you a VB.NETter? ;)
>
>> In VBNet does "object.whatever" mean by default "object.whatever()"
>> what
>> it
>> would be in classic C. What can it be else, however it is checked with
>> background compiling by the IDE in VBNet, a feature that does not
>> exist
>> in
>> C#.
> I don't understand how this feature could be useful - won't this result
> in
> errors that could be easily prevented? For example, if someone
> misspells a
> method name in VB.NET - this would create a run-time exception, whereas
> this
> would be caught @ compile time in C# (much better).
>
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.742 / Virus Database: 495 - Release Date: 19/08/2004

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.742 / Virus Database: 495 - Release Date: 19/08/2004

Jul 21 '05 #10

P: n/a
Rakesh,

C# derives originaly from C, VBNet derives originaly from BASIC.

However from/in both are in my opinion only a lot of legacy things stayed
and are not really the language anymore.

C#, VBNet, J# and partialy C++ uses exactly the same namespaces (classes).
Where there is as well a VisualBasic namespace which is standard in VBNet
and can implemented in the other languages.

C#, VBNet, J# are completly new designed for OOP. VBNet looks only at BASIC
where it uses a lot of keywords and operators, however those are based on
the English and mathimatical use and you do find them in a lot of other
languages. (especially the operators)

VBNet is working completly different from VB6 which is not an OOP language.

To say it easier, it is not difficult to translate a C# program to VBNet,
there are a lot of good translaters for that. (In my opinion much easier
than VB6 to VBNet wherefore is a "VBcompatible" namespace needed)

There are less for VBNet to C# translators; I think because most do not know
that you can implement the VisualBasic namespace in C#.

Cor

I feel it's more OOPs like because OOPs started with c++ and c# derives it's most of it's syntax from c++ and java...most of the keywords map directly
with what OOPs states....with VB.NET, i feel it's more like an 'add-on' to an existing set of keywords, rather than pure thing u know...

The point i want to bring here is that as C# was developed from scratch
based on OOPs and all, it's seeminlgy very usable.

Don't you feel so?

Rakesh

Jul 21 '05 #11

This discussion thread is closed

Replies have been disabled for this discussion.