Example Code
The following code snippet displays a message box saying "Hello, World!" as the window loads:
Private Sub Form_Load ' Execute a simple message box that will say "Hello, World!" MsgBox "Hello, World!"End SubThis snippet makes a counter that moves up 1 every second (a label and a timer control need to be added to the form for this to work):
Option Explicit Dim Count As Integer Private Sub Form_Load Count = 0 Timer1.Interval = 1000 ' units of milliseconds End Sub Private Sub Timer1_Timer Count = Count + 1 Label1.Caption = Count End SubRead more about this topic: Visual Basic
Famous quotes containing the word code:
“Wise Draco comes, deep in the midnight roll
Of black artillery; he comes, though late;
In code corroborating Calvins creed
And cynic tyrannies of honest kings;
He comes, nor parlies; and the Town, redeemed,
Gives thanks devout; nor, being thankful, heeds
The grimy slur on the Republics faith implied,
Which holds that Man is naturally good,
Andmoreis Natures Roman, never to be
scourged.”
—Herman Melville (18191891)
“Many people will say to working mothers, in effect, I dont think you can have it all. The phrase for have it all is code for have your cake and eat it too. What these people really mean is that achievement in the workplace has always come at a priceusually a significant personal price; conversely, women who stayed home with their children were seen as having sacrificed a great deal of their own ambition for their families.”
—Anne C. Weisberg (20th century)