0% found this document useful (0 votes)
44 views

Exercise 1

This code generates a random tip for handling or storing CDs/DVDs when a button is clicked. It uses the random number generator to select between 1-3 and display the corresponding tip in a label based on whether it equals 1, 2, or neither. The tips advise handling discs by the center or edges, keeping away from extreme temperatures and moisture, or storing in jewel cases or sleeves to prevent scratches.

Uploaded by

api-308657631
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
44 views

Exercise 1

This code generates a random tip for handling or storing CDs/DVDs when a button is clicked. It uses the random number generator to select between 1-3 and display the corresponding tip in a label based on whether it equals 1, 2, or neither. The tips advise handling discs by the center or edges, keeping away from extreme temperatures and moisture, or storing in jewel cases or sleeves to prevent scratches.

Uploaded by

api-308657631
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 1

Public Class Form1

Public Sub DisplayTip()


Dim randomnum As Integer
randomnum = Int(Rnd() * 3) + 1

If randomnum = 1 Then
Label1.Text = "Handle CD/DDs by the center hole or by the edges."

ElseIf randomnum = 2 Then


Label1.Text = "Keep CD/DVDs away from extreme temperatures and moisture."

Else
Label1.Text = "Store discs in a jewel case or sleeve to prevent scratches."

End If

End Sub

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)


Handles Button1.Click
DisplayTip()
End Sub
End Class

You might also like