Question 1. I'm a pretty rubbish coder, haven't really done much of it in the couple of years since my degree, at work they've recently expressed an interest in getting me back into it. My problem is that i feel as though I've been taught the syntax (which i totally understand) I can easily write up a a for loop or whatever, my problem is knowing how to apply that. So i guess I would define it as knowing the words of another language but not having any idea how to speak fluently lol. Any ideas where i can start getting some help ? useful links would be appreciated, preferably anything that helped you guys that is more about how to code rather than syntax (i plan to spend more time on here etc).
Question 2, which is sort of an example of my problem (see below), I actually broke this when trying to fix it (trying to add in the return 1,2,3 for the different possibilities), but basically I'm currently struggling with using forms. Using 2 random numbers the user must enter the correct answer for multiplying the random numbers. How can I empty the fields and basically reset the form after a correct answer ?
Public Class MathLoader Dim generator As New Random Dim a1 As Integer = generator.Next(1, 100) Dim b1 As Integer = generator.Next(1, 100) Public MathLoader() Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load End Sub Private Function correctCheck() As Integer Dim z1 As Double = a1 * b1 Dim x1 As Integer = 0 If TextBox1.Text = "" Then Label3.Text = "Please enter a value" Return 2 ElseIf TextBox1.Text = z1 Then Label3.Text = "Correct !" ans1.Text = z1 Beep() Return 1 Else Label3.Text = "Wrong..." Return 3 End If End Function Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click 'Try ran1.Text = a1 ran2.Text = b1 If ans1.Text = "" Then MessageBox.Show("Please enter a response") ElseIf ans1.Text <> "" Then For index = 1 To 3 If Me.correctCheck() = 1 Then MessageBox.Show("Complete") ElseIf Me.correctCheck() = 2 Then MessageBox.Show("2") ElseIf Me.correctCheck() = 3 Then MessageBox.Show("3") Else MessageBox.Show("4") End If Next MessageBox.Show("You're out of guesses") End If 'Catch e As Exception ' MessageBox.Show(e.ToString) 'End Try End Sub End Class
Edited 3 Years Ago by mike_2000_17: Fixed formatting