Button-Driven Quotes

This programming challenge is from a Visual Basic.Net programming course I took in Spring 2008. The Chapter (1) was titled “Introduction to Visual Basic .Net 2005″.

I post these old academic challenges for a few reasons. One is to demonstrate my programming learning, experience, and progression. Another reason is to make sure my code and solutions are indexed by search engines, so that other beginning programmers may get help if they need it.

1.3: Write a project that displays four short sayings. When the saying displays on your form, long lines will run off the form if the label’s AutoSize property is set to True. To wrap text within the label, change the AutoSize property to False and use the sizing handles to make the label large enough.
Make a button for each saying with a descriptive Text property for each, as well as a button to exit the project.
Include a label that holds your name at the bottom of the form. Also, make sure to change the form’s title bar to something meaningful.
Change the Font properties of the large label to the font and size of your choice.
Make sure the buttons are large enough to hold their entire Text properties.
Follow good naming conventions for object names; include remarks at the top of every procedure and at the top of the file.

My solution code:

'Assignment 1
'Problem 1.3
'Kirk Hingsberger
'Display four sayings

Public Class quotesForm

    Private Sub exitButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles exitButton.Click
        ' Exits program

        Me.Close()
    End Sub

    Private Sub proofButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles proofButton.Click
        ' Display Proof quote above

        Me.quotesLabel.Text = "I remember the time I was kidnapped and they sent a piece of my finger to my father. He said he wanted more proof."
    End Sub

    Private Sub argueButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles argueButton.Click
        ' Display Argue quote above

        Me.quotesLabel.Text = "Only a fool argues with a skunk, a mule or the cook."
    End Sub

    Private Sub upstreamButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles upstreamButton.Click
        ' Display Upstream quote above

        Me.quotesLabel.Text = "Always drink upstream from the herd."
    End Sub

    Private Sub pmsButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles pmsButton.Click
        ' Display PMS quote above

        Me.quotesLabel.Text = "Do you know why they call it 'PMS'? Because 'Mad Cow Disease' was already taken."
    End Sub
End Class

My solution’s build screenshot:

Press a button to get a quote

Press a button to get a quote

  • Share/Bookmark




Leave a Reply