判断LISTBOX被选中解决方法
判断LISTBOX被选中
为什么在VS2010中没有SELECTED属性。
------解决方案--------------------
if (listBox1.GetSelected(index))
------解决方案--------------------
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim i As Int16
For i = 0 To ListBox1.Items.Count - 1
If ListBox1.GetSelected(i) Then
MsgBox(i)
Exit For
End If
Next
End Sub
Private Sub Form3_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Dim i As Int16
For i = 0 To 5
ListBox1.Items.Add("yy" & i.ToString)
Next
End Sub
For iCtr = 1 To lstItem(pSrcIndex).Items.Count
'If lstItem(pSrcIndex).Items(iCtr - 1).Selected Then
End If
Next ictr
为什么在VS2010中没有SELECTED属性。
------解决方案--------------------
if (listBox1.GetSelected(index))
------解决方案--------------------
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim i As Int16
For i = 0 To ListBox1.Items.Count - 1
If ListBox1.GetSelected(i) Then
MsgBox(i)
Exit For
End If
Next
End Sub
Private Sub Form3_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Dim i As Int16
For i = 0 To 5
ListBox1.Items.Add("yy" & i.ToString)
Next
End Sub