Help with forms.

binold

Member
Joined
Jul 8, 2008
Messages
17
Programming Experience
1-3
Hi,

The form that I created just blinks out when I compile it and run it through command line. Any idea to make it still? Note: I am just using notepad not the IDE. Thanks.

Imports System.Windows.Forms
Public Class Form1
Inherits Form

' Control declaration: a Button and a TextBox
Private Button1 As Button
Private TextBox1 As TextBox

Public Sub New()
InitializeComponent()
End Sub


Private Sub InitializeComponent()


Me.Text = "Developer Form"
Me.Width = 400
Me.Height = 300

Button1 = New Button()
TextBox1 = New TextBox()

Button1.Left = 200
Button1.Top = 200
Button1.Width = 100
Button1.Height = 40
Button1.TabIndex = 0
Button1.Text = "Click Me"

TextBox1.Left = 200
TextBox1.Top = 30
TextBox1.Width = 150
TextBox1.Height = 40

Me.Controls.Add(Button1)
Me.Controls.Add(TextBox1)

End Sub

End Class

Module Module1
Sub Main()

Dim a As Form1 = New Form1()

a.Show()



End Sub
End Module
 
You're not running the form as an application, so the code reaches the 'End Sub' line in your Sub Main pretty quick
VB.NET:
Module Module1
  Sub Main()
    Application.Run(New Form1())
  End Sub
End Module
 
Back
Top