Hello,
I am a student and have not been doing VB.NET long.
I have 5 testboxes where the user enteres values. I need to select the highest and lowest value from these boxes and put the two figures in there own veriable.
Please not i am a beginer, so i only need very simple code. Also i need the result to be calculates with a loop.
Here is the code i have:
Please can you help
I am a student and have not been doing VB.NET long.
I have 5 testboxes where the user enteres values. I need to select the highest and lowest value from these boxes and put the two figures in there own veriable.
Please not i am a beginer, so i only need very simple code. Also i need the result to be calculates with a loop.
Here is the code i have:
VB.NET:
'Set Global Veraibales
Dim MaxValue As Integer
Dim MinValue As Integer
Dim count As Integer
Dim marks(4) As Integer
'Find Min Value
Dim marksC As Integer = 99999
marks(0) = txtMark1.Text
marks(1) = txtMark2.Text
marks(2) = txtMark3.Text
marks(3) = txtMark4.Text
marks(4) = txtMark5.Text
For count = 0 To 4
If marks(count) < marksC Then
MinValue = marks(count)
End If
'put value in minValue
marksC = MinValue
Next
lblResult.Text = MinValue
'Find MaxValue
Dim marksC1 As Integer = -99999
marks(0) = txtMark1.Text
marks(1) = txtMark2.Text
marks(2) = txtMark3.Text
marks(3) = txtMark4.Text
marks(4) = txtMark5.Text
For count = 0 To 4
If marks(count) > marksC1 Then
MaxValue = marks(count)
End If
Next
lblResult2.Text = MaxValue
Please can you help