|
|||||||||||
|
AUTO COMPUTE TOTAL 'Programer: C Maruca Bagel, Salad, Soda Option Explicit Dim BPrice As Currency Dim S1Price As Currency Dim S2Price As Currency Dim Bagel As Currency Dim Salad As Currency Dim Soda As Currency Dim TotalPrice As Currency Private Sub chkBagel_Click() If chkBagel.Value = vbChecked Then BPrice = 2.25 fraBox2.Visible = True fraBox2.Enabled = True lblBagelPrice.Visible = True End If If chkBagel.Value = vbUnchecked Then fraBox2.Visible = False fraBox2.Enabled = False lblBagelPrice.Visible = False lblBagelPrice.Caption = "" chkCreamCheese.Value = False chkLox.Value = False End If lblBagelPrice.Caption = FormatCurrency(BPrice, 2) Bagel = lblBagelPrice.Caption TotalPrice = Bagel + Salad + Soda lblTotal.Caption = FormatCurrency(TotalPrice, 2) End Sub Private Sub chkLox_Click() If chkLox.Value = vbChecked Then BPrice = BPrice + 1.2 End If If chkLox.Value = vbUnchecked Then BPrice = BPrice - 1.2 End If lblBagelPrice.Caption = FormatCurrency(BPrice, 2) Bagel = lblBagelPrice.Caption TotalPrice = Bagel + Salad + Soda lblTotal.Caption = FormatCurrency(TotalPrice, 2) End Sub Private Sub chkCreamCheese_Click() If chkCreamCheese.Value = vbChecked Then BPrice = BPrice + 1# End If If chkCreamCheese.Value = vbUnchecked Then BPrice = BPrice - 1 End If lblBagelPrice.Caption = FormatCurrency(BPrice, 2) Bagel = lblBagelPrice.Caption TotalPrice = Bagel + Salad + Soda lblTotal.Caption = FormatCurrency(TotalPrice, 2) End Sub Private Sub chkSalad_Click() If chkSalad.Value = vbChecked Then fraBox3.Visible = True fraBox3.Enabled = True lblSaladPrice.Visible = True End If End Sub Private Sub chkSoda_Click() If chkSoda.Value = vbChecked Then fraBox4.Visible = True fraBox4.Enabled = True lblSodaPrice.Visible = True End If End Sub Private Sub Form_Load() optSpinach.Value = False optChef.Value = False optCola.Value = False optCreamSoda.Value = False End Sub Private Sub optSpinach_Click() S1Price = 2.75 lblSaladPrice.Caption = FormatCurrency(S1Price, 2) Salad = lblSaladPrice.Caption TotalPrice = Bagel + Salad + Soda lblTotal.Caption = FormatCurrency(TotalPrice, 2) End Sub Private Sub optChef_Click() S1Price = 3.25 lblSaladPrice.Caption = FormatCurrency(S1Price, 2) Salad = lblSaladPrice.Caption TotalPrice = Bagel + Salad + Soda lblTotal.Caption = FormatCurrency(TotalPrice, 2) End Sub Private Sub optCola_Click() S2Price = 1.25 lblSodaPrice = FormatCurrency(S2Price, 2) Soda = lblSodaPrice.Caption TotalPrice = Bagel + Salad + Soda lblTotal.Caption = FormatCurrency(TotalPrice, 2) End Sub Private Sub optCreamSoda_Click() S2Price = 1.25 lblSodaPrice.Caption = FormatCurrency(S2Price, 2) Soda = lblSodaPrice.Caption TotalPrice = Bagel + Salad + Soda lblTotal.Caption = FormatCurrency(TotalPrice, 2) End Sub BAGEL WITH COMMAND BUTTON
'Programer: C Maruca Bagel, Salad, Soda If chkBagel.Value = vbChecked Then BPrice = 2.25 fraBox2.Visible = True fraBox2.Enabled = True lblBagelPrice.Visible = True End If If chkBagel.Value = vbUnchecked Then fraBox2.Visible = False fraBox2.Enabled = False lblBagelPrice.Visible = False lblBagelPrice.Caption = "" chkCreamCheese.Value = False chkLox.Value = False End If lblBagelPrice.Caption = FormatCurrency(BPrice, 2) End Sub Private Sub chkLox_Click() If chkLox.Value = vbChecked Then BPrice = BPrice + 1.2 End If If chkLox.Value = vbUnchecked Then BPrice = BPrice - 1.2 End If lblBagelPrice.Caption = FormatCurrency(BPrice, 2) End Sub Private Sub chkCreamCheese_Click() If chkCreamCheese.Value = vbChecked Then BPrice = BPrice + 1# End If If chkCreamCheese.Value = vbUnchecked Then BPrice = BPrice - 1 End If lblBagelPrice.Caption = FormatCurrency(BPrice, 2) End Sub Private Sub chkSalad_Click() If chkSalad.Value = vbChecked Then fraBox3.Visible = True fraBox3.Enabled = True lblSaladPrice.Visible = True End If End Sub Private Sub chkSoda_Click() If chkSoda.Value = vbChecked Then fraBox4.Visible = True fraBox4.Enabled = True lblSodaPrice.Visible = True End If End Sub Private Sub cmdComputeTotal_Click() Bagel = lblBagelPrice.Caption Salad = lblSaladPrice.Caption Soda = lblSodaPrice.Caption TotalPrice = Bagel + Salad + Soda lblTotal.Caption = FormatCurrency(TotalPrice, 2) End Sub Private Sub Form_Load() optSpinach.Value = False optChef.Value = False optCola.Value = False optCreamSoda.Value = False End Sub Private Sub optSpinach_Click() S1Price = 2.75 lblSaladPrice.Caption = FormatCurrency(S1Price, 2) End Sub Private Sub optChef_Click() S1Price = 3.25 lblSaladPrice.Caption = FormatCurrency(S1Price, 2) End Sub Private Sub optCola_Click() S2Price = 1.25 lblSodaPrice = FormatCurrency(S2Price, 2) End Sub Private Sub optCreamSoda_Click() S2Price = 1.25 lblSodaPrice.Caption = FormatCurrency(S2Price, 2) End Sub 'Programer: cMaruca; Bagel Cmd w/If Then Logic, message Option Explicit Dim BPrice As Currency Dim S1Price As Currency Dim S2Price As Currency Dim TotalPrice As Currency Dim Bagel As Currency Dim Salad As Currency Dim Soda As Currency Private Sub chkBagel_Click() If chkBagel.Value = vbChecked Then fraBox2.Visible = True fraBox2.Enabled = True lblBagelPrice.Visible = True BPrice = 2.25 End If lblBagelPrice.Caption = BPrice End Sub Private Sub chkSalad_Click() If chkSalad.Value = vbChecked Then fraBox3.Visible = True fraBox3.Enabled = True lblSaladPrice.Visible = True End If End Sub Private Sub chkSoda_Click() If chkSoda.Value = vbChecked Then fraBox4.Visible = True fraBox4.Enabled = True lblSodaPrice.Visible = True End If End Sub 'Command Button Hot Private Sub cmdComputeTotal_Click() If chkLox.Value = vbChecked Then BPrice = BPrice + 1.2 End If If chkCreamCheese.Value = vbChecked Then BPrice = BPrice + 1 End If 'Salad If optSpinach.Value = True Then S1Price = 2.75 ElseIf optChef.Value = True Then S1Price = 3.25 ElseIf chkSalad.Value = vbChecked Then MsgBox "PLEASE MAKE A SELECTION. FAILURE TO DO SO WILL RESULT IN DEFAULT AND YOU WILL RECEIVE TODAY'S SPECIAL! SPAM,EGGS,SPAM,SPAM,SPAM,AND SPAM!!" Exit Sub End If 'Soda If optCola.Value = True Then S2Price = 1.25 ElseIf optCreamSoda.Value = True Then S1Price = 1.25 ElseIf chkSoda.Value = vbChecked Then MsgBox "PLEASE SELECT A BEVERAGE." Exit Sub End If 'Total Line Items lblBagelPrice.Caption = FormatCurrency(BPrice, 2) lblSaladPrice.Caption = FormatCurrency(S1Price, 2) lblSodaPrice.Caption = FormatCurrency(S2Price, 2) 'Variables Bagel = lblBagelPrice.Caption Salad = lblSaladPrice.Caption Soda = lblSodaPrice.Caption 'Grand Total TotalPrice = Bagel + Salad + Soda lblTotal.Caption = FormatCurrency(TotalPrice, 2) End Sub 'Setup Private Sub Form_Load() optSpinach.Value = False optChef.Value = False optCola.Value = False optCreamSoda.Value = False End Sub EMPLOYEE BONUS CONVERTING VALUES INTO STRING (VALID, INVALID) 'Programer: C Maruca
Option Explicit Private Sub Form_Load() Form1.Show 'Get Name IName = InputBox("Enter a Name") If Len(IName) > 18 Or Len(IName) = 0 Then 'Salary
'Department 'Title 'Form 2 CALC BONUS WITH OPT AND CHK BOX 'Programer: C Maruca Private Sub chkService_Click() Private Sub Form_Load() Private Sub opt1_Click() TIC-TAC-TOE Option Explicit Dim X As String Dim O As String Dim Player As String Dim Winner As String Dim Response As Integer Private Sub cmd1_Click() cmd1.Caption = Player cmd1.Enabled = False If Player = "X" Then Player = "O" Else Player = "X" End If If cmd1.Caption = cmd2.Caption And cmd1.Caption = cmd3.Caption Then Winner = cmd1.Caption ElseIf cmd1.Caption = cmd5.Caption And cmd1.Caption = cmd9.Caption Then Winner = cmd1.Caption ElseIf cmd1.Caption = cmd4.Caption And cmd1.Caption = cmd7.Caption Then Winner = cmd1.Caption End If If Winner = cmd1.Caption Then MsgBox "Winner is" & Winner End If Private Sub cmdReset_Click() Player = X cmd1.Caption = "" cmd2.Caption = "" cmd3.Caption = "" cmd4.Caption = "" cmd5.Caption = "" cmd6.Caption = "" cmd7.Caption = "" cmd8.Caption = "" cmd9.Caption = "" Winner = "" cmd1.Enabled = True cmd2.Enabled = True cmd3.Enabled = True cmd4.Enabled = True cmd5.Enabled = True cmd6.Enabled = True cmd7.Enabled = True cmd8.Enabled = True cmd9.Enabled = True End Sub Private Sub Form_Load() Player = "X" End Sub |
|||||||||||