Imports Controls, StdCtrls, Forms, Dialogs Class MyForm Inherits TForm Published Button1 As TButton Sub Button1Click(Sender As TObject) ShowMessage("Hello!") End Sub Sub New MyBase.Create(null) Caption = "My second paxCompiler GUI Application" Button1 = New TButton(Me) With Button1 .Parent = Me .Caption = "Click Me" .Name = "Button1" .Left = 10 .Top = 20 .OnClick = Button1Click End With End Sub End Class Dim F As MyForm = New MyForm Try F.ShowModal Finally F.Free End Try