By failing to prepare, you are preparing to fail.
- Benjamin Franklin
News
Site News
Latest Comments
Affiliates
Proxies
Contribute!
Chat
Tutorials
Newest Articles
Most Popular
Highest Rated
Latest Comments
Code Samples
Newest Code
Most Popular
Highest Rated
Latest Comments
Blogs
Admins Blog
Newest Blogs
Most Popular
Highest Rated
Latest Comments
Forums
Latest Posts
Latest Topics
Memberlist
[login]
|
[Register]
States and Capitals
by: bs0d
Description:
Uses two control arrays with option buttons, optStates and optCapitals. Verify, print and exit command buttons. lblAnswer will indicate the result when verify is clicked. See image for guide.
See Full Size
Code:
Option Explicit Dim varState As Integer, varCapital As Integer Private Sub cmdExit_Click() 'Will terminate the program Unload frmStates End Sub Private Sub cmdPrint_Click() 'Will print the form Print Form End Sub Private Sub cmdVerify_Click() If varState = varCapital Then lblAnswer.Caption = "Correct" Else lblAnswer.Caption = "Incorrect" End If End Sub Private Sub Form_Load() 'center frmStates.Left = (Screen.Width - frmStates.Width) / 2 frmStates.Top = (Screen.Height - frmStates.Height) / 2 'default optState(0).Value = True optCapital(0).Value = True lblAnswer.Caption = "" End Sub Private Sub Form_Unload(Cancel As Integer) 'Will ask if the user is sure they want to exit... Const conButtons As Integer = vbYesNo + vbExclamation + vbDefaultButton1 + vbApplicationModal Dim intRes As Integer intRes = MsgBox("Do you REALLY want to exit?", conButtons, "Colfax Industries") If intRes = vbNo Then Cancel = 1 End If End Sub Private Sub optCapital_Click(Index As Integer) varCapital = optCapital(Index).Index lblAnswer.Caption = "" End Sub Private Sub optState_Click(Index As Integer) varState = optState(Index).Index lblAnswer.Caption = "" End Sub
No Comments for this page.
You Must be
signed in
or a
member
to comment.
Code Stats
12,709
Views
0
Total Comments
0
Rating of 5 (
1
Votes)
Code Options
·
Login to Rate This Code
·
Login to Post a Comment
·
Read more by this author
Related
·
RGB Color Fader
·
Adder
·
Math Problems
·
Cut and Paste
·
Combo Box Colors
·
Flag Viewer
"AllSyntax.com" Copyright © 2002-2019; All rights lefted, all lefts righted.
Privacy Policy
|
Internet Rank