Why is my WinForm a blank window?

Marlene

New member
Joined
Jul 10, 2006
Messages
2
Programming Experience
10+
I'm teaching myself vb.net (in the hopes of landing a job after staying home for the past 6 1/2 years to raise my children :) !). I am following a tutorial online from Programmer's Heaven, and I believe I typed in the code (using Visual Studio) exactly as it's presented, but I get a blank WinForm, ie. it doesn't contain my title (just says Form1) nor my text (it's a completely empty window).

Here's the code. Please excuse the comments; they're my learning aid:eek: :

Imports System ' Application class is defined here
' Also need references to these assemblies by adding references in project
Imports System.Windows.Forms ' Base classes for Windows controls
Imports System.Drawing ' For drawing controls
Class Test
Public Sub main()
Application.Run(
New MyForm())
End Sub
End
Class
Class
MyForm
Inherits Form
Public Sub New()
MyBase.New()
Me.Text = "Na, na, I'm learning vb.net!"
Me.Size = New Size(300, 300)
Dim lblGreeting As New Label()
lblGreeting.Text =
"Hello WinForm"
lblGreeting.Location = New Point(100, 100)
Me.Controls.Add(lblGreeting)
End Sub
End
Class


I did add the references to both System.Windows.Forms and Sytem.Drawing but something else must be wrong/missing.

Here's the website where the tutorial is:
http://www.programmersheaven.com/2/Les_VBNET_11_p1

Thanks in advance for your help.

Marlene
 
Perhaps you created a new Windows Application project and there was already a form there called Form1, which also would be set by default as Startup Form in application settings. You may change the Startup Form in application settings, or better, use the form that is already there and build from that.
 
Back
Top