7-3-1

Private Sub Form_Load()

Dim depNum As Integer

For depNum = 0 To 4

lblDepart(depNum).Caption = "Department" & Str(depNum + 1)

Next depNum

End Sub

Private Sub cmdCompute_Click()

Dim depNum As Integer, sales As Single

sales = 0

For depNum = 0 To 4

sales = sales + Val(txtSales(depNum).Text)

Next depNum

picTotal.Cls

picTotal.Print "Total sales were " & FormatCurrency(sales)

End Sub

 

 

7-3-2

Private Sub cmdDigit_Click(index As Integer)

lblPhoneNum.Caption = lblPhoneNum.Caption & Right(Str(index), 1)

If Len(lblPhoneNum.Caption) = 3 Then

lblPhoneNum.Caption = lblPhoneNum.Caption & "-"

ElseIf Len(lblPhoneNum.Caption) = 8 Then

MsgBox "Dialing ...", , ""

lblPhoneNum.Caption = ""

End If

End Sub

 

7-3-3

Private Sub Form_Load()

Dim i As Integer, monthNames As String

monthNames = "FebMarAprMayJunJulAugSepOctNovDec"

For i = 1 To 11

Load lblMonth(i)

Load txtInfo(i)

lblMonth(i).Top = lblMonth(i - 1).Top + txtInfo(0).Height

txtInfo(i).Top = txtInfo(i - 1).Top + txtInfo(0).Height

lblMonth(i).Caption = Mid(monthNames, 3 * i - 2, 3)

lblMonth(i).Visible = True

txtInfo(i).Visible = True

Next i

End Sub