Thursday, September 20, 2012

Finished Program w/ Screenshots- Magic 8 Ball



Window 1
Question Box


Public Class frmAsk

Private Sub btnHelp_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnHelp.Click
MsgBox("I need somebody. Help, not just anybody. Do you really need help with this? Come on, just press the damn button.")
'Display joke help box
End Sub

Private Sub btnExit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnExit.Click
End
End Sub

Private Sub btnAsk_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnAsk.Click
frmAnswer.Show()
'Show other windows form which displays answer form
End Sub
End Class


Window 2
Answer Box
Answer Form
Public Class frmAnswer

Private Sub lblAnswer_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles lblAnswer.Click
End Sub

Private Sub frmAnswer_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

lblAnswer.Text = Int(Rnd() * 5 + 1)
'Generate Random integer between 1 and 5

Select Case lblAnswer.Text
Case 1
lblAnswer.Text = "DO I LOOK LIKE A MAGIC 8 BALL PROGRAM TO YOU?"
Case 2
lblAnswer.Text = "Come on, ask a better question."
Case 3
lblAnswer.Text = "As a wise burger once said, eeyup."
Case 4
lblAnswer.Text = "What is a question? A rose by any other- wait..." & vbCrLf & "Uh... No. No to your question."
Case 5
lblAnswer.Text = "Why ask such a question? Alas, humanity has truly produced it's most despicable work."

'Depending on the number generated in the Answer text, display respective answer

Case Else
lblAnswer.Text = "Error"
'If something goes wrong, the Answer text displays error
End Select
End Sub

Private Sub btnClose_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnClose.Click
Me.Hide()

End Sub
End Class

No comments:

Post a Comment