首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > .NET > VB Dotnet >

判断LISTBOX被选中解决思路

2012-10-23 
判断LISTBOX被选中VB.NET codeFor iCtr 1 To lstItem(pSrcIndex).Items.CountIf lstItem(pSrcIndex).It

判断LISTBOX被选中

VB.NET code
For iCtr = 1 To lstItem(pSrcIndex).Items.Count     'If lstItem(pSrcIndex).Items(iCtr - 1).Selected Then                                End IfNext 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

热点排行