Laboratory activity 3 b2

798 views
733 views

Published on

0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
798
On SlideShare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
31
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

Laboratory activity 3 b2

  1. 1. Laboratory Activity 3 (Batch 2) Multiplication Program Public Class Form1 Private num1 As Integer Private num2 As Integer Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load GenerateRandomQuestion() End Sub Sub GenerateRandomQuestion() Dim objRandom As Random = New Random() num1 = objRandom.Next(1, 10) num2 = objRandom.Next(1, 10) Label4.Text = "How much is " & num1 & " times " & num2 & "?" End Sub Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click GenerateRandomQuestion() Label3.Text = " " TextBox1.Clear() 'disable New Question button Button2.Enabled = False 'enable verify button Button1.Enabled = True End Sub Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim prod As Integer prod = TextBox1.Text If (num1 * num2) = prod Then Label3.Text = "You Got the correct answer!!"
  2. 2. 'disable Verify button Button1.Enabled = False 'enable Next Question button Button2.Enabled = True Else Label3.Text = "Please Try Again" End If End Sub End Class

×