Hello, I’m trying to write a code which would allow me to write 2 random numbers and then show the larger number when clicked on a button called “Display Largest”, below you can see my code which I have written. If anyone is able to fix it for me – please do, thank you:
Public Class Form1
Dim First As Integer
Dim Second As Integer
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnLargest.Click
First = Val(txtFirst.Text)
Second = Val(txtSecond.Text)
If First > Second Then
btnLargest = First ‘Confused as to what write in here :/
MessageBox.Show(“txtFirst.text”)
Else
txtLargest = txtSecond ‘Please help me with this part as well
MessageBox.Show(“txtSecond”)
‘Basically I want to see the larger number when clicked on “btnLargest” (Button1_Click)
‘I’m clearly having some problems with “IF” and “ELSE” functions.
End If
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
Me.Close()
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
txtFirst.Clear()
txtSecond.Clear()
txtLargest.Clear()
End Sub
Private Sub txtbox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtFirst.TextChanged
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
End Sub
Private Sub txtLargest_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtLargest.TextChanged
End Sub
End Class
Read this back to me, in plain English (no symbols).
How To Ask Questions The Smart Way