can't remove listitem from ddl in loop

M

mharness

Hello,

Any ideas why this code will not remove listitems for the dropdownlist?

Protected Sub CullProjects()
Dim ProjectName As String
If Me.gvRequestProjects.Rows.Count > 0 Then
For Each row As GridViewRow In Me.gvRequestProjects.Rows
ProjectName =
Trim(Me.gvRequestProjects.DataKeys(row.RowIndex).Values(1).ToString)
Me.ddlProjects.Items.Remove(ProjectName)
Next
End If
End Sub

ProjectName is a valid name of an item in the ddl. Using something very
similar to this on a one-by-one basis and it works correctly but not in this
code.

Thanks,

Mike
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top