• Welcome to Valhalla Legends Archive.
 

My first VB.NET program.

Started by Grok, May 28, 2003, 01:38 PM

Previous topic - Next topic

Grok


   Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
       System.Windows.Forms.MessageBox.Show("Hello, World!", "Test Application Message Box", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1, MessageBoxOptions.ServiceNotification)
       Me.Close()
   End Sub


Kinda verbose, if you want my opinion.

banditxx99

yeah that was verbose. you don't have to fully qualify System.Windows.Forms.MessageBox.Show though.

MessageBox.Show() would work.

Etheran

Quote from: banditxx99 on May 28, 2003, 03:14 PM
yeah that was verbose. you don't have to fully qualify System.Windows.Forms.MessageBox.Show though.

MessageBox.Show() would work.
That's not necessarily ture.

Banana fanna fo fanna

I have vb.net uploaded, 3 isos out of 4.

banditxx99

For him it would since he already has a reference to the System.Windows.Forms namespace.

But in general, providing a reference to the namespace in question will allow you to forego with the full qualification to objects within that namespace.

K

QuoteI have vb.net uploaded, 3 isos out of 4.
Missing a CD? I count five. Maybe you don't need the component update one.

Etheran

#6
Quote from: banditxx99 on May 28, 2003, 08:30 PM
For him it would since he already has a reference to the System.Windows.Forms namespace.

But in general, providing a reference to the namespace in question will allow you to forego with the full qualification to objects within that namespace.
In most cases, yes, he would have a reference to the namespace; however, it is not a good idea to assume he, in fact, does have System.Windows.Forms referenced.

banditxx99

Granted my vb.net knowledge is far lower than c#.. so i have a question.

Would


Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

End Sub


or

Me.Close()


even compile without a reference to System.Windows.Forms?  In my test, it would not.. but maybe I'm missing something.

Anyway, my point was you can make it verbose, or use the means available to you to make it less verbose.

Yoni

What means? Not using .NET? ;)

Etheran

Quote from: banditxx99 on May 29, 2003, 09:44 AM
Granted my vb.net knowledge is far lower than c#.. so i have a question.

Would


Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

End Sub


or

Me.Close()


even compile without a reference to System.Windows.Forms?  In my test, it would not.. but maybe I'm missing something.

Anyway, my point was you can make it verbose, or use the means available to you to make it less verbose.
Me.Close() should compile just fine.  I, too, am more of a c# fan and am not sure if MyBase.Load would compile without System.Windows.Forms referenced.

Etheran

Quote from: Etheran on May 29, 2003, 05:01 PM
Quote from: banditxx99 on May 29, 2003, 09:44 AM
Granted my vb.net knowledge is far lower than c#.. so i have a question.

Would


Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

End Sub


or

Me.Close()


even compile without a reference to System.Windows.Forms?  In my test, it would not.. but maybe I'm missing something.

Anyway, my point was you can make it verbose, or use the means available to you to make it less verbose.
Me.Close() should compile just fine.  I, too, am more of a c# fan and am not sure if MyBase.Load would compile without System.Windows.Forms referenced.

However, that was not the point I was trying to make :p

Xae

Long time no see $t0rm =) I've gotta get ahold of you btw

And grok, vb.net is not all that verbose, it is better for some things than others =x

I prefer programming in c#, more or less because it is almost a java clone with .net capabilities =) however its identicle to vb.net in the sense that if you drop the semi colons, and add a few dim statements you get a vb.net app =x

Banana fanna fo fanna

angryhickclowN on AIM. Nice to see you back.