1 Imports System.Windows.Forms
\r
2 Imports System.Drawing
\r
7 ' Create a new instance of the form.
\r
9 Dim button1 As Button
\r
10 Dim button2 As Button
\r
13 button1 = New Button()
\r
14 button2 = New Button()
\r
16 ' Set the text of button1 to "OK".
\r
18 ' Set the position of the button on the form.
\r
19 button1.Location = New Point(10, 10)
\r
20 ' Set the text of button2 to "Cancel".
\r
21 button2.Text = "Cancel"
\r
22 ' Set the position of the button based on the location of button1.
\r
23 button2.Location = New Point(button1.Left, button1.Height + button1.Top + 10)
\r
24 ' Set the caption bar text of the form.
\r
25 form1.Text = "My Dialog Box"
\r
26 ' Display a help button on the form.
\r
27 form1.HelpButton = True
\r
29 ' Define the border style of the form to a dialog box.
\r
30 form1.FormBorderStyle = FormBorderStyle.FixedDialog
\r
31 ' Set the MaximizeBox to false to remove the maximize box.
\r
32 form1.MaximizeBox = False
\r
33 ' Set the MinimizeBox to false to remove the minimize box.
\r
34 form1.MinimizeBox = False
\r
35 ' Set the accept button of the form to button1.
\r
36 form1.AcceptButton = button1
\r
37 ' Set the cancel button of the form to button2.
\r
38 form1.CancelButton = button2
\r
39 ' Set the start position of the form to the center of the screen.
\r
40 form1.StartPosition = FormStartPosition.CenterScreen
\r
42 ' Add button1 to the form.
\r
43 form1.Controls.Add(button1)
\r
44 ' Add button2 to the form.
\r
45 form1.Controls.Add(button2)
\r
47 ' Display the form as a modal dialog box.
\r