Create Form window by hand : Form « GUI « VB.Net Tutorial






Option Strict On

Imports System.Drawing
Imports System.Windows.Forms

Public Class Form1 : Inherits Form
   Private WithEvents cmdClickCtr As Button = New Button()

   Public Sub New()
      Me.cmdClickCtr.Location = New Point(100, 75)
      Me.cmdClickCtr.Size = New Size(100, 50)
      Me.cmdClickCtr.Text = "Click Counter"
      
      Me.Controls.Add(cmdClickCtr)
      Me.Text = "Click Counter"
   End Sub
   
   Private Sub cmdClickCtr_Click(ByVal sender As System.Object, _
               ByVal e As System.EventArgs) _
               Handles cmdClickCtr.Click
      Static ctr As Integer = 1
      MsgBox("Button was clicked " & ctr & " times.")
      ctr += 1
   End Sub
   
   Public Shared Sub Main()
      Dim frm As New Form1()
      frm.ShowDialog()
   End Sub
End Class








14.49.Form
14.49.1.Create Form window by hand
14.49.2.Add control to Form dynamicallyAdd control to Form dynamically
14.49.3.Set Form IconSet Form Icon
14.49.4.Form Fade outForm Fade out
14.49.5.Border Less formBorder Less form
14.49.6.Owner draw form
14.49.7.Build Form hierarchicallyBuild Form hierarchically
14.49.8.Form InheritanceForm Inheritance
14.49.9.SendKeysSendKeys
14.49.10.Form: show, hide and get data fromForm: show, hide and get data from
14.49.11.Auto Scroll FormAuto Scroll Form