Valhalla Legends Archive

Programming => General Programming => Topic started by: Grok on May 28, 2003, 01:38 PM

Title: My first VB.NET program.
Post by: Grok on May 28, 2003, 01:38 PM

   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.
Title: Re:My first VB.NET program.
Post by: 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.
Title: Re:My first VB.NET program.
Post by: Etheran on May 28, 2003, 07:35 PM
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.
Title: Re:My first VB.NET program.
Post by: Banana fanna fo fanna on May 28, 2003, 08:29 PM
I have vb.net uploaded, 3 isos out of 4.
Title: Re:My first VB.NET program.
Post by: 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.
Title: Re:My first VB.NET program.
Post by: K on May 28, 2003, 09:55 PM
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.
Title: Re:My first VB.NET program.
Post by: Etheran on May 29, 2003, 02:50 AM
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.
Title: Re:My first VB.NET program.
Post by: 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.
Title: Re:My first VB.NET program.
Post by: Yoni on May 29, 2003, 09:46 AM
What means? Not using .NET? ;)
Title: Re:My first VB.NET program.
Post by: 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.
Title: Re:My first VB.NET program.
Post by: Etheran on May 29, 2003, 05:04 PM
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
Title: Re:My first VB.NET program.
Post by: Xae on June 18, 2003, 07:33 AM
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
Title: Re:My first VB.NET program.
Post by: Banana fanna fo fanna on June 18, 2003, 02:45 PM
angryhickclowN on AIM. Nice to see you back.