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?
