|
-
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.
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
|