Results 1 to 5 of 5

Thread: Form Fundamentals

Threaded View

  1. #1

    Thread Starter
    PowerPoster
    Join Date
    Dec 2003
    Location
    Bristol, England (but heart is in Virginia)
    Posts
    2,949

    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:
    1. Imports System
    2. Imports System.ComponentModel
    3. Imports System.Drawing
    4. Imports System.Windows.Forms
    5.  
    6. Namespace Microsoft.Samples.WinForms.VB.SimpleHelloWorld
    7.  
    8.     Public Class SimpleHelloWorld
    9.          Inherits System.Windows.Forms.Form
    10.  
    11.         'Run the application
    12.         <STAThread()> Shared Sub Main()
    13.             System.Windows.Forms.Application.Run(New SimpleHelloWorld())
    14.         End Sub
    15.  
    16.         Public Sub New()
    17.             MyBase.New()
    18.             Me.Text = "Hello World"
    19.         End Sub
    20.     End Class
    21.  
    22. 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
  •  



Click Here to Expand Forum to Full Width