Coding examples

Here are some fine examples to get you to understand how to code even more:

1) Requires a form & a command button

Private Sub Command1_Click()

    Command1.Caption = "VB's easy" We are switching the command button's caption

End Sub

2) Requires a form & a command button

Private Sub Command1_Click()

    Form1.WindowState = 1 'Now we are changing form1's window state to "1" which is the minimized state

End Sub

3) Requires a form & a command button & a textbox

Private Sub Command1_Click()

    Text1.Enabled = False 'We just disabled the text box so no one can use it

End Sub

As you can see we can switch control, and form properties even at runtime...

Here are some basic codes to know...

End Quits your program
Form2.show Shows form2
Date Shows the date
Time Shows the time
Form1.WindowState = 1 Minimizes form1
Form1.Hide Hides the form
Unload Me Unloads the current form from memory

You should have a better understanding of VB codes right about now since you're almost through the basics...


Coding basics                                   Comparison operators