OK guys I am to the point now I would just like to see this program run the way it need to gonna post the code I have not asking anybody to write it for me but give me some information and just let me know how bad my code looks I'm sure that I have several bad practices and such going on any info you can give me will be great. there is just a couple of thing that isn't work at the moment and that is in division the numbers are not working out to be evenly divisible
Public Class Slection
Inherits System.Windows.Forms.Form
Private Sub gui_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
max_top.Hide()
max_btm.Hide()
lblDirections.Hide()
Label1.Hide()
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Gui.Show()
Gui.Timer1.Enabled = True
End Sub
Private Sub ComboBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DDL.SelectedIndexChanged
subject = DDL.SelectedIndex
If check = 0 Then lblDirections.Show()
max_top.Show()
If check = 1 Then lblDirections.Show()
max_top.Show()
If check = 2 Then lblDirections.Show()
max_top.Show()
If check = 3 Then lblDirections.Show()
max_top.Show()
Label1.Show()
max_btm.Show()
End Sub
Private Sub max_top_ValueChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles max_top.ValueChanged
randnumtop = max_top.Value
End Sub
Private Sub max_btm_ValueChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles max_btm.ValueChanged
randnum = max_btm.Value
End Sub
Public Sub time_ValueChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles time.ValueChanged
myTime = (time.Value) * 60
End Sub
End Class
Public Class Gui
Inherits System.Windows.Forms.Form
Public Sub Getnew()
usranswer.Text = ""
usranswer.Focus()
If Correct > 0 Then RightLabel.Show()
If countTotal > 0 Then TotalLabel.Show()
If Missed > 0 Then Missedlabel.Show()
RightLabel.Text = Correct & "Correct"
Missedlabel.Text = Missed & "Missed"
TotalLabel.Text = countTotal & "Total"
End Sub
Private Sub gui_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
FormBorderStyle = FormBorderStyle.FixedSingle
Timer1.Enabled = True
check = subject
Slection.Hide()
RightLabel.Hide()
TotalLabel.Hide()
Missedlabel.Hide()
RightLabel.BackColor = Color.Transparent
TotalLabel.BackColor = Color.Transparent
Missedlabel.BackColor = Color.Transparent
Select Case check
Case "0"
Me.signbox.Image = Image.FromFile("C:\value\add.png")
Case "1"
Me.signbox.Image = Image.FromFile("C:\value\sub.gif")
Case "2"
Me.signbox.Image = Image.FromFile("C:\value\mul.gif")
Case "3"
Me.signbox.Image = Image.FromFile("C:\value\div.gif")
End Select
countTotal = 0
Correct = 0
Missed = 0
If subject = 3 Then Call dproblem() Else
Call problem()
Call Getnew()
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Select Case check
Case "0"
Call CheckAnswer_Add()
Case "1"
Call CheckAnswer_subtract()
Case "2"
Call CheckAnswer_Multiply()
Case "3"
Call CheckAnswer_Divide()
End Select
countTotal = Int(countTotal) + 1
End Sub
Private Sub ExitToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ExitToolStripMenuItem.Click
End
Me.Close()
End Sub
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
Timer1.Interval = 1000
myTime = myTime - 1
TTLtxt.Text = myTime
If myTime < 1 Then
Timer1.Enabled = False
MsgBox("Times Up!")
MsgBox("Your score is : " & (CInt(score) - CInt(points) & "%"))
TTLtxt.Hide()
My.Computer.FileSystem.WriteAllText("c:\value\value1.txt", "your Score is:" & score, False)
Me.Close()
Slection.Show()
Else
End If
ProgressBar1.Maximum = (Slection.time.Value) * 59
If ProgressBar1.Value = ProgressBar1.Maximum Then
Timer1.Enabled = False
Else
ProgressBar1.Value = ProgressBar1.Value + 1
End If
End Sub
End Class
Module variables
Public answer, reply, countTotal, randnum, randnumtop, num1, num2, Correct, Missed, score, points, myTime As Integer
Public RandomClass1 As New Random()
Public check, subject, div As String
Public Sub CheckAnswer_Multiply()
Integer.TryParse(Gui.TopNumLabel.Text, num1)
Integer.TryParse(Gui.ConstantLabel.Text, num2)
Integer.TryParse(Gui.usranswer.Text, reply)
answer = CInt(num1 * num2)
End Sub
Public Sub CheckAnswer_Add()
Integer.TryParse(Gui.TopNumLabel.Text, num1)
Integer.TryParse(Gui.ConstantLabel.Text, num2)
Integer.TryParse(Gui.usranswer.Text, reply)
answer = CInt(num1 + num2)
End Sub
Public Sub CheckAnswer_subtract()
Integer.TryParse(Gui.TopNumLabel.Text, num1)
Integer.TryParse(Gui.ConstantLabel.Text, num2)
Integer.TryParse(Gui.usranswer.Text, reply)
answer = CInt(num1 - num2)
End Sub
Public Sub CheckAnswer_Divide()
Integer.TryParse(Gui.TopNumLabel.Text, num1)
Integer.TryParse(Gui.ConstantLabel.Text, num2)
Integer.TryParse(Gui.usranswer.Text, reply)
answer = CInt(num1 / num2)
End Sub
Public Sub UC()
If answer = reply Then Correct = Int(Correct) + 1
If Int(answer) <> Int(reply) Then Missed = Int(Missed) + 1
If Int(answer) <> Int(reply) Then MsgBox(CStr(answer), MsgBoxStyle.Information, Title:=("Wrong"))
points = ((100 / CInt(countTotal)) * CInt(Missed))
score = 100
If countTotal = 100 Then MsgBox("Great work you have completed 100 questions")
End Sub
Public Sub dproblem()
Dim dnum1 As Integer
Dim dnum2 As Integer = RandomClass1.Next(1, randnumtop)
Dim danswer As Integer = RandomClass1.Next(1, 10)
dnum1 = dnum2 * answer
Gui.TopNumLabel.Text = dnum1
Gui.ConstantLabel.Text = dnum2
End Sub
Public Sub problem()
Gui.TopNumLabel.Text = RandomClass1.Next(randnumtop)
Gui.ConstantLabel.Text = RandomClass1.Next(randnum)
If Integer.Parse(Gui.TopNumLabel.Text) < Integer.Parse(Gui.ConstantLabel.Text) Then
Call problem()
Else
End If
End Sub
Public Function GetRandom(ByVal Min As Integer, ByVal Max As Integer) As Integer
Static RandomClass1 As System.Random = New System.Random()
Return RandomClass1.Next(randnumtop, randnum)
End Function
End Module