Let's say we've been hired to design The World's Ugliest Demo for a particular computer company.
lblTitle
, at the top of the screen.
tmrTitle
.
If Toggle = 1 Then Toggle = 0 lblTitle.Caption = "Al's Discount Miscellany" Else Toggle = 1 lblTitle.Caption = "" End If |
Dim Toggle As Integer
to the Form's (General) (Declarations)
section.
OK, now we have a flashing title for our demo. Now to add a list of products.
cmbProducts
. This will contain a list of products.
lblProductInfo
. This label will display a descriptive message for the product chosen in the Combo Box.
lblProductInfo
's BorderStyle property to 1, and make its font something outrageous.
cmbProducts.List(0) = "Machine Guns" cmbProducts.List(1) = "Feather Beds" cmbProducts.List(2) = "Storm Doors" cmbProducts.List(3) = "Nuclear Reactors" cmbProducts.ListIndex = 0 |
cmbProducts
' Click procedure:
If cmbProducts.ListIndex = 0 Then lblProductInfo.Caption = "Direct from the source in Italy!" ElseIf cmbProducts.ListIndex = 1 Then lblProductInfo.Caption = "We hand-pluck our chickens." ElseIf cmbProducts.ListIndex = 2 Then lblProductInfo.Caption = "Providing a steady storm above the doorjamb." ElseIf cmbProducts.ListIndex = 3 Then lblProductInfo.Caption = "Tested at Chernobyl and Three Mile Island." End If |
Now to add something truly silly.
btnDont
. Set its caption to "Don't Click Me!", and make sure to change its font and colors (maybe purple on black?).
btnDont
's Click procedure:
temp = MsgBox("Erasing all files....", vbAbortRetryIgnore, "You asked for it") If temp = vbAbort Then temp = MsgBox("Aborting files. Files erased.", vbOKOnly, "OK") ElseIf temp = vbRetry Then temp = MsgBox("Trying again...erased your files this time.", vbOKOnly, "Cancel") Else temp = MsgBox("OK, I'm ignoring you. Your files are erased.", vbOKOnly, "Help") End If |