8.1. Windows forms – an introduction

Let’s start our discussion by creating a simple example of a Windows application that will run under Microsoft .NET. Here is the code:

'-------------------------------------------
' WinMin – Minimal .NET Windows Application 
'-------------------------------------------
Imports System 
Imports System.Windows.Forms 

 Public Class MyForm 
  Inherits System.Windows.Forms.Form 

  Shared Sub Main() 
   System.Windows.Forms.Application.Run(New MyForm()) 
  End Sub 

  Public Sub New() 
   MyBase.New() 
  End Sub 
 End Class 

We compile this code with the following command line:

> vbc WinMin.vb /t:WinExe /r:system.dll /r:system.windows.forms.dll 

where:

  • vbc is the Visual Basic.NET command-line compiler;

  • WinMin.vb is the name of the source file; ...

Get A Programmer's Guide to .NET now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.