Question
I’m attempting to create the functioning GUI (bottom photo) from the coding in the first photo. I’m unclear as to what I’m missing to complete the code. Thank you
a Homework 8 similar to Exercise 16 8.pdf (page 1 of 2) Public Class Formi Dim answer As Integer Sub Random() Dim random As New Random() answer randon.Next (1, 1ee) End Sub Private Sub Formi Load(ByVal sender As System.Object, Byval e As System. EventArgs) Handles MyBase. Load Random() End Sub Private Sub Button1 click(ByVal sender As System.Object, ByVal e As Systen.EventAres) Handles Buttoni.Click If Val (TextBox1.Text) answer Thern End If If Val(TextBoxi. Text) answer Then End If If Val (TextBox1.Text) answer Then End If If Label4·Text “ Correct Then End If Labe14.Text Too high... Labe14. Text Too low... Labe14.Text Correct Button2.Enabled True End Sub private sub Button2 click(eyval sender As Systen.object, Byval e As Systen.Eventares) Handles Button2.Click Labe14.Text TextBox1.Clear() Random() Button2.Enabled False End Sub End Class
media%2Ffac%2Ffacc5903-ea88-4037-989b-fd
0 0
Add a comment Improve this question Transcribed image text
Answer #1

Sub Random ) Dim random As New Random ) answer= random . Next (1, 100) End Sub on loading the form Private Sub Forml_Load (BGuess the Number I have a number between 1 and 100. Can you guess my number? Enter Guess 59 Result Too high.. New GameGuess the Number I have a number between 1 and 100. Can you guess my number? Enter Guess 55 Result Correct New Game

Copyable Code:

'From1 class

Public Class Form1

    Dim answer As Integer

    'Procedure Random to generate a random number between 1 and 100

    Sub Random()

        Dim random As New Random()

        answer = random.Next(1, 100)

    End Sub

    'on loading the form

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

        Random()

    End Sub

    'On clicking button1

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

        'Disable the Button2

        Button2.Enabled = False

        'Check the condition

        If Val(TextBox1.Text) > answer Then

            TextBox2.Text = "Too high..."

        End If

        'Check the condition

        If Val(TextBox1.Text) < answer Then

            TextBox2.Text = "Too low..."

        End If

        'Check the condition

        If Val(TextBox1.Text) = answer Then

            TextBox2.Text = "Correct"

            Button2.Enabled = True

        End If

    End Sub

    'On clicking the "Button2"

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click

        'Clear TextBox2

        TextBox2.Text = ""

        'Clear TextBox1

        TextBox1.Clear()

        'Call Function

        Random()

        'Disble Button2

        Button2.Enabled = False

    End Sub

End Class

Add a comment
Know the answer?
Add Answer to:
I’m attempting to create the functioning GUI (bottom photo) from the coding in the first photo....
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • I am new to programming (2 weeks of playing with it) I have written code for...

    I am new to programming (2 weeks of playing with it) I have written code for a timer in Visual Studio 2013. I am wondering if someone can show me how to write code/what the code would look like in a MODULE1.vb. I was thinking that for this timer I could create MsgBox using a DO UNTIL LOOP that would pop up every 20 seconds that says "hurry up!" until 1 minute has passed. As I said I am just...

  • Project 2 – Memory Match Game Purpose This Windows Classic Desktop application plays a simple matching game. The game si...

    Project 2 – Memory Match Game Purpose This Windows Classic Desktop application plays a simple matching game. The game simulates a card game where the cards a placed face down and the player flips over pairs of cards in an attempt to find matching cards.   Program Procedure Display a 4x4 grid of “face down” cards. Assign the letters A through H randomly to the cards in pairs. Allow the user to click on a card to “flip” it over and...

  • Any way to add a counter?, to count the elements/ # of prime factors outputted to...

    Any way to add a counter?, to count the elements/ # of prime factors outputted to TextBox2.Text. VB Public Class Form1 Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.click Dim n As Long Dim i As Long Dim k As Long Dim Prime As Boolean n = TextBox1.Text For i = 2 To n If n Mod i = 0 Then k = 2 Prime = False While k <i / 2 If i Mod k = 0...

  • WITH THIS CODE, ADD TO THE EXIT BUTTON THAT ALLOWS THE USER TO SEE UPON EXITING,...

    WITH THIS CODE, ADD TO THE EXIT BUTTON THAT ALLOWS THE USER TO SEE UPON EXITING, HOW MANY QUESTIONS THEY GOT RIGHT AND WRONG. Public Class Form1 Dim r As Random = New Random Dim no1, no2 As Integer Private Sub rdbAdd_CheckedChanged(sender As Object, e As EventArgs) Handles rdbAdd.CheckedChanged txtAnswer.Clear() txtAnswer.BackColor = Color.White no1 = randomInt() no2 = randomInt() lblOperation.Text = "+" txtNumber1.Text = no1.ToString() txtNumber2.Text = no2.ToString() End Sub Public Function randomInt() As Integer Return r.Next(20, 120) End Function...

  • Project 10-1 Convert lengths In this assignment, you’ll add code to a form that converts the valu...

    Project 10-1 Convert lengths In this assignment, you’ll add code to a form that converts the value the user enters based on the selected conversion type. The application should handle the following conversions: From To Conversion Miles - Kilometers: 1 mile = 1.6093 kilometers Kilometers - Miles: 1 kilometer = 0.6214 miles Feet - Meters: 1 foot = 0.3048 meters Meters - Feet: 1 meter = 3.2808 feet Inches - Centimeters: 1 inch = 2.54 centimeters Centimeters - Inches: 1...

  • Visual Basic: Create an application that simulates a tic tac toe game. The form uses 9...

    Visual Basic: Create an application that simulates a tic tac toe game. The form uses 9 large labels to display the x's and o's. The application should use a two dimensional integer array to simulate the game board in memory. When the user clicks the "New Game" button the application should step throguh the array storing a random number of 0 to 1 in each element. The numer 0 represent the letter o and the number 1 reprsents the letter...

  • In this exercise, you’ll add code to a form that converts the value the user enters...

    In this exercise, you’ll add code to a form that converts the value the user enters based on the selected conversion type. The application should handle the following conversions: 1. Open the Conversions project. Display the code for the form, and notice the rectangular array whose rows contain the value to be displayed in the combo box, the text for the labels that identify the two text boxes, and the multiplier for the conversion as shown above. Note: An array...

  • I'm having trouble getting this page to run. the first picture has the coding and the...

    I'm having trouble getting this page to run. the first picture has the coding and the second picture has the error message. i also attached my tables if it would help. E Edit View Website Build Debug Team Tools Architecture Test Analyze Window Help Sign in 2. Debug A ny CPU - Internet Explorer 11 : ? 1 C P Addbooks.aspx.vb* = X Addbooks.aspx e datademo 1 btnadd Click e Partial Class Addbooks Inherits System.Web.UI. Page Dim on As New...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
Active Questions
ADVERTISEMENT