循环遍历Listbox的选中项,在删除!!!VB Protected Sub LinkButton2_Click(ByVal sender As Object, ByVa
ProtectedSubLinkButton2_Click(ByValsenderAsObject,ByValeAsSystem.EventArgs)HandlesLin...
Protected Sub LinkButton2_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles LinkButton2.Click
Dim li As ListBox = New ListBox()
For Each list As ListItem In Me.ListBox2.Items
If list.Selected Then
li.Items.Add(list.Text)
Me.ListBox2.Items.Remove(li.Text.ToString())
End If
Next
End Sub
运行时报错:修改集合;枚举操作可能不执行。
哪位高手求解一下,,
Protected Sub LinkButton1_Click1(ByVal sender As Object, ByVal e As System.EventArgs) Handles LinkButton1.Click
For Each li As ListItem In Me.ListBox1.Items
If li.Selected Then
Me.ListBox2.Items.Add(li.Text.ToString())
End If
Next
End Sub
这是向listbox2中添加
自己已经解决~!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
For Each li As ListItem In Me.ListBox1.Items
If li.Selected Then
Me.ListBox2.Items.Add(li.Text.ToString())
End If
Next
While Me.ListBox2.SelectedIndex > -1
Me.ListBox2.Items.RemoveAt(Me.ListBox2.SelectedIndex)
End While 展开
Dim li As ListBox = New ListBox()
For Each list As ListItem In Me.ListBox2.Items
If list.Selected Then
li.Items.Add(list.Text)
Me.ListBox2.Items.Remove(li.Text.ToString())
End If
Next
End Sub
运行时报错:修改集合;枚举操作可能不执行。
哪位高手求解一下,,
Protected Sub LinkButton1_Click1(ByVal sender As Object, ByVal e As System.EventArgs) Handles LinkButton1.Click
For Each li As ListItem In Me.ListBox1.Items
If li.Selected Then
Me.ListBox2.Items.Add(li.Text.ToString())
End If
Next
End Sub
这是向listbox2中添加
自己已经解决~!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
For Each li As ListItem In Me.ListBox1.Items
If li.Selected Then
Me.ListBox2.Items.Add(li.Text.ToString())
End If
Next
While Me.ListBox2.SelectedIndex > -1
Me.ListBox2.Items.RemoveAt(Me.ListBox2.SelectedIndex)
End While 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询