|
-
Mar 8th, 2004, 05:18 AM
#1
Thread Starter
PowerPoster
Form Fundamentals
Hi,
After browsing this site for three months, I have realised that my attempt to learn VB.NET has sufferred from many gaps, so I have started to go through a re-learning schedule. That took me to
http://samples.gotdotnet.com/quickstart/winforms/
Their very first coding is
VB Code:
Imports System
Imports System.ComponentModel
Imports System.Drawing
Imports System.Windows.Forms
Namespace Microsoft.Samples.WinForms.VB.SimpleHelloWorld
Public Class SimpleHelloWorld
Inherits System.Windows.Forms.Form
'Run the application
<STAThread()> Shared Sub Main()
System.Windows.Forms.Application.Run(New SimpleHelloWorld())
End Sub
Public Sub New()
MyBase.New()
Me.Text = "Hello World"
End Sub
End Class
End Namespace
In experimenting with it I found that you could remove
"Imports System
Imports System.ComponentModel
Imports System.Drawing
Imports System.Windows.Forms"
and the programme would still work O.K. Can anyone tell me if there is any reason for including such apparently unnecessary code?
Also, the following seems to be unnecessary:
"Inherits System.Windows.Forms.Form" as
"Inherits Form"
appears to work perfectly O.K. (with or without the foregoing Imports)
Finally, the following also appears to be unnecessary
" <STAThread()> Shared Sub Main()"
as
" Shared Sub Main()"
works O.K. on its own. Anyone know why Com interoperability is put here?
Many thanks for any input.
EDIT: I see my [VB Code] is not working. Anyone know why?
Last edited by taxes; Mar 8th, 2004 at 03:59 PM.
Taxes
The more I learn about VB.NET the more I like dBaseIII Plus
The foregoing, whilst believed to be correct, is given without guarantee as to it's accuracy and entirely without recourse. You are required to decide for yourself whether or not it is suitable for your purposes and no liability for loss of any nature can be entertained.
-
Mar 8th, 2004, 01:25 PM
#2
-
Mar 8th, 2004, 04:04 PM
#3
Thread Starter
PowerPoster
Hi MrPolite,
So, none of it is necessary? Yet Microsoft are teaching this for experienced programmers new to VB.NET!!
"umm and I dont know what statThread does"
It introduces COM interopability, but I see no need for it in the sample they used. It allows you to use DAO and ADO amongst other things.
Many thanks.
Taxes
The more I learn about VB.NET the more I like dBaseIII Plus
The foregoing, whilst believed to be correct, is given without guarantee as to it's accuracy and entirely without recourse. You are required to decide for yourself whether or not it is suitable for your purposes and no liability for loss of any nature can be entertained.
-
Mar 8th, 2004, 05:22 PM
#4
well yeah it's not necessary but I guess they always put it there just to make it more clear... you may wanna ask some more advanced users here, because I'm not officially a programmer, at least not yet
rate my posts if they help ya!
Extract thumbnail without reading the whole image file: (C# - VB)
Apply texture to bitmaps: (C# - VB)
Extended console library: (VB)
Save JPEG with a certain quality (image compression): (C# - VB )
VB.NET to C# conversion tips!!
-
Mar 8th, 2004, 07:10 PM
#5
Addicted Member
bleh. i think it'd be better to start out with not using those. do it the harder way (well not necessarily in all cases but in this case) and when you get better take the shortcuts. that's my thinking.
you can just ignore me. i don't know much about programming or vb.net anyway. just learning.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|