我正在尝试制作其中有一系列按钮。单击每个按钮,然后在它旁边有一个标签,记录按钮获得的点击次数。
然后我能够从该集合中获得最大的整数(单击按钮的最大次数)。所以我得到了这个数字,我很困惑如何将最高数字与点击次数最多的按钮相关联,以便我可以自动在显示最常用按钮的列表框中添加一个项目。
//////--Code to import the greatest integer of all the collection (clicked more times)---
`Private Sub Button1_Click_2(ByVal sender As System.Object, ByVal e As `enter code here`System.EventArgs) Handles Button1.Click
1. Dim nums() As Integer = {x1.Text, x2.Text, x3.Text, x4.Text, x5.text}
2. Dim qry = From n As Integer In nums Order By n Descending
3. For Each n As Integer In qry
4. listbox1.Items.Add(n)
5. Next
6. End Sub`
//////---code to get the single number which was greater than every other in the collection///-
`Private Sub Button2_Click_2(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
1. Dim nums() As Integer = {x1.Text, x2.Text, x3.Text, x4.Text, x5.text}
2. Dim qry = From n As Integer In nums Order By n Descending
3. Dim res As Integer = nums.Max.ToString
4. For Each i As Integer In nums
5. If i > res Then res = i
6. Label120.Text = res.ToString
7. Next
8. Return
9. End Sub`