codice:
Imports System
Imports System.Windows.Forms
Imports System.Drawing
Namespace civiProva
public Class Finestra
Inherits Form
Private Label1 as New Label()
Private components As System.ComponentModel.Container
Public Sub New()
MyBase.New
CreaComponenti()
End Sub
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Dispose()
End If
End If
MyBase.Dispose(disposing)
End Sub
Private Sub CreaComponenti()
Me.SuspendLayout()
Label1.Location = New System.Drawing.Point(50, 50)
Label1.Text="ciao"
Label1.AutoSize = True
Label1.Name = "Descrizione"
Label1.Size = New System.Drawing.Size(200, 100)
Me.Controls.AddRange(New System.Windows.Forms.Control() {Label1})
Me.Size = New System.Drawing.Size(400, 300)
Me.ResumeLayout()
End Sub
end Class
public Class provaExe
Public Shared Sub Main()
Dim win as New Finestra()
win.ShowDialog()
End Sub
end Class
End Namespace
Questo funziona e si vede un label "ciao"
Per compilarlo
vbc.exe /t:winexe /r:system.dll /r:system.windows.forms.dll /r:system.drawing.dll /m:civiProva.provaExe c:\prova\proveExe\main.vb
Comunque non prendere solo il mio esempio come vangelo. Consula msdn
Ciao