I have a program that I need to write, and I am not really getting how to get an array to work the way I am thinking. Basically I have 6 text boxes which the user will enter numbers. I need to write an array that takes the values from the 6 boxes, drops the lowest value of the 6 and calculates the remaining 5 of them. I know how to do the array if the numbers were in a list box, but I am not understanding how to go about it since they are in 6 different text boxes.
My code so far is:
Private Sub btntotal_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btntotal.Click
Dim int1, int2, int3, int4, int5, int6, inttotal as integer
int1 = txt1.Text
int2 = txt2.Text
int3 = txt3.Text
int4 = txt4.Text
int5 = txt5.Text
int6 = txt6.Text
txttotal.Text = Str(inttotal)
The only thing my brain keeps coming back to would be how to find the minimum value in a listbox, but I know I am way off:
Dim intMin, intMax, intTotal As Integer
Dim intElement As Integer
intMax = Integer.MinValue
intTotal = 0
For Each intElement In Me.lstList.Items
intTotal += intElement
If intElement < intMin Then
intMin = intElement
End If
I hope someone can understand this as I've been racking my brain for a few hours now, any points in the right direction will be helpful, or if I need to explain better let me know.
thanks
My code so far is:
Private Sub btntotal_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btntotal.Click
Dim int1, int2, int3, int4, int5, int6, inttotal as integer
int1 = txt1.Text
int2 = txt2.Text
int3 = txt3.Text
int4 = txt4.Text
int5 = txt5.Text
int6 = txt6.Text
txttotal.Text = Str(inttotal)
The only thing my brain keeps coming back to would be how to find the minimum value in a listbox, but I know I am way off:
Dim intMin, intMax, intTotal As Integer
Dim intElement As Integer
intMax = Integer.MinValue
intTotal = 0
For Each intElement In Me.lstList.Items
intTotal += intElement
If intElement < intMin Then
intMin = intElement
End If
I hope someone can understand this as I've been racking my brain for a few hours now, any points in the right direction will be helpful, or if I need to explain better let me know.
thanks