Halloween party ideas 2015

General Declarations:
Option Explicit
Dim Activity As String


cmdExit Click Event:
Private Sub cmdExit_Click()
End
End Sub


cmdNew Click Event:
Private Sub cmdNew_Click()
'Blank out name and reset check boxes
Dim I As Integer
txtName.Text = ""
txtAge.Text = ""
For I = 0 To 5
chkAct(I).Value = vbUnchecked
Next I


End Sub
cmdShow Click Event:
Private Sub cmdShow_Click()
Dim NoAct As Integer, I As Integer
Dim Msg As String, Pronoun As String
'Check to make sure name entered
If txtName.Text = "" Then
Exploring the Visual Basic Toolbox 3-33
MsgBox "The profile requires a name.", vbOKOnly +
vbCritical, "No Name Entered"
Exit Sub
End If
'Check to make sure age entered
If txtAge.Text = "" Then
MsgBox "The profile requires an age.", vbOKOnly +
vbCritical, "No Age Entered"
Exit Sub
End If
'Put together customer profile message
Msg = txtName.Text + " is" + Str$(txtAge.Text) + " years
old." + vbCr
If optSex(0).Value = True Then Pronoun = "He " Else
Pronoun = "She "
Msg = Msg + Pronoun + "lives in " + cboCity.Text + "." +
vbCr
Msg = Msg + Pronoun + "is a"
If optLevel(3).Value = False Then Msg = Msg + "n " Else
Msg = Msg + " "
Msg = Msg + Activity + " level athlete." + vbCr
NoAct = 0
For I = 0 To 5
If chkAct(I).Value = vbChecked Then NoAct = NoAct + 1
Next I
If NoAct > 0 Then
Msg = Msg + "Activities include:" + vbCr
For I = 0 To 5
If chkAct(I).Value = vbChecked Then Msg = Msg +
String$(10, 32) + chkAct(I).Caption + vbCr
Next I
Else
Msg = Msg + vbCr
End If
MsgBox Msg, vbOKOnly, "Customer Profile"
End Sub


Form Load Event:
Private Sub Form_Load()
'Load combo box with potential city names
cboCity.AddItem "Seattle"
cboCity.Text = "Seattle"
cboCity.AddItem "Bellevue"
cboCity.AddItem "Kirkland"
cboCity.AddItem "Everett"
cboCity.AddItem "Mercer Island"
cboCity.AddItem "Renton"
cboCity.AddItem "Issaquah"
cboCity.AddItem "Kent"
cboCity.AddItem "Bothell"
cboCity.AddItem "Tukwila"
cboCity.AddItem "West Seattle"
cboCity.AddItem "Edmonds"
cboCity.AddItem "Tacoma"
cboCity.AddItem "Federal Way"
cboCity.AddItem "Burien"
cboCity.AddItem "SeaTac"
cboCity.AddItem "Woodinville"
Activity = "intermediate"
End Sub


optLevel Click Event:
Private Sub optLevel_Click(Index As Integer)

Select Case Index
Case 0
Activity = "extreme"
Case 1
Activity = "advanced"
Case 2
Activity = "intermediate"
Case 3
Activity = "beginner"
End Select
End Sub


txtAge KeyPress Event
Private Sub txtAge_KeyPress(KeyAscii As Integer)
If (KeyAscii >= vbKey0 And KeyAscii <= vbKey9) Or KeyAscii
= vbKeyBack Then
Exit Sub
Else
KeyAscii = 0
End If
End Sub
Next
This is the most recent post.
Previous
Older Post

Post a Comment

Powered by Blogger.