Quantcast
Channel: VBForums
Viewing all articles
Browse latest Browse all 42359

Check integer value to arraylist value

$
0
0
Hello dear programmers!
My program has 2 labels which when pressed increment an integer.
I add the value of the integers to an array which I sort. I then compare the value of the integer back to every index of the array but this doesnt seem to work?
Any help will be much appreciated

Matthijs
Code:

Private Sub bLabel1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles bLabel1.Click
        amount2+=1
    End Sub

    Private Sub bLabel2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles bLabel2.Click
        amount1 +=1
    End Sub
dim list as new arraylist
dim amount1,amount2 as integer

            list.Add(amount1)
            list.Add(amount2)
            list.Sort()
   
            Dim first, second As Integer
            first = list.Item(1)
            Second = list.Item(2)

            Select Case amount1
                Case Is = first
                    bPictureBox2.Image = My.Resources.greenarrow
                    bLbl2.Text += 0.3
                Case Is = second
                    bPictureBox2.Image = My.Resources.redarrow
                    bLbl2.Text -= 0.3
            End Select

           
        End If
  Select Case amount2
                Case Is = first
                    bPictureBox1.Image = My.Resources.greenarrow
                    bLbl1.Text += 0.3
                Case Is = second
                    bPictureBox1.Image = My.Resources.redarrow
                    bLbl1.Text -= 0.3
            End Select

           
        End If

        list.Clear()


Viewing all articles
Browse latest Browse all 42359

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>