Create a project named Chaos that includes five or more clickable objects such as buttons, pictureboxes, and/or labels. When the user clicks the buttons (or pictureboxes), random things occur. For example, clicking a button that says "Rain" could cause the background color of the form to change to blue. Or, clicking a button that says "Don't Click Me" could cause that button to turn invisible. Clicking a button that says "Right" could move a Pacman graphic to the right.
Be sure to immediately name all objects with proper prefixes as soon as you place them on the form.
Here are some example statements that will do interesting things in button Click methods:
lblBomb.Text = "BOOM"
lblCar.BackColor = Color.Blue ' changes the background color of an object
lblTruck.ForeColor = Color.HotPink ' changes the color of the text on an object
lblPhrase.Visible = False ' makes the object invisible
lblPhrase.Visible = True ' makes the object visible
lblPhrase.Top = 50 ' any number less than 300
lblPhrase.Left = 250 ' any number less than 300
btnBig.Width = 200 ' changes the width of an object
btnSmall.Height = 5 ' changes the height of an object
lblRocket.Left = lblRocket.Left + 10 ' moves the label to the right
lblRocket.Left = lblRocket.Left - 10 ' moves the label to the left
lblRocket.Top = lblRocket.Top + 10 ' moves the label down the screen
lblRocket.Top = lblRocket.Top - 10 ' moves the label up the screen
Me.BackColor = Color.White ' changes the background color of the whole form
picPacman.Left = picPacman.Left + 10 ' moves the picture box to the right
picPacman.Left = picPacman.Left - 10 ' moves the picture box to the left
picPacman.Top = picPacman.Top + 10 ' moves the picture box down the screen
picPacman.Top = picPacman.Top - 10 ' moves the picture box up the screen
System.Diagnostics.Process.Start("www.weather.com") ' opens a web page
It is not required but you may use If Else statements to make your program more interesting. For example, the following code would cause the screen to flicker when a button is pressed
If (Me.BackColor = Color.GreenYellow) Then
Me.BackColor = Color.HotPink
Else
Me.BackColor = Color.GreenYellow
End If
You may include and animate PictureBoxes (i.e. graphics) in your project if you can figure out how to do so on your own. The prefix for a PictureBox is pic. The following code would cause a PictureBox to move to the left and wrap around from the right edge of the screen
picPacman.Left -= 10
If (picPacman.Left <= 0) Then
picPacman.Left = 300
End If
Here is a former student's Chaos project as an example.
It is important for your code to be easy-to-understand
and easy to upgrade. So use blank lines between methods and a comment above each method. Review the Programming Assignment Check-Off Sheet and make sure that your program follows the Coding
Standards before your project is graded.
When you are finished with the project, call the instructor to your computer.
- He will execute the program to evaluate if it works correctly. This is called the "runtime grade."
- He will look at your code to be sure that it is complete and that it is typed and formatted neatly (i.e. follows the Coding Standards).
Upload the following files to DropItTo.Me/minich_vb. Your first name and last initial should replace "JohnD" in the filenames.
- Follow these directions to make a screen capture graphic named ChaosJohnD.png. The screen capture must be taken after a successful test case that matches one on your test plan.
- Follow these directions to make a screencast video named ChaosJohnD.mp4
- Follow these directions to make a pdf of your source code named ChaosJohnD.pdf