digitaldrew
Well-known member
- Joined
- Nov 10, 2012
- Messages
- 167
- Programming Experience
- Beginner
Hey everyone..I am trying to loop through all the items in a listbox that are checked (and basically skip over the ones that are unchecked)..The problem is, if there are 7 items that are unchecked before starting - the loop will say its completed when there are still 7 items left in the listbox..It basically counts the number of items that are unchecked - and then stops short by that number..
Here is a little of my code:
Any help here would be appriciated
Here is a little of my code:
VB.NET:
Public Class Form1
Dim count as integer
Private Sub btnStart_Click(sender As System.Object, e As System.EventArgs) Handles btnStart.Click
count = lstSubmissionSites.CheckedItems.Count
End Sub
Private Sub SubmitThread_DoWork(sender As System.Object, e As System.ComponentModel.DoWorkEventArgs) Handles SubmitThread.DoWork
Dim submitworker As BackgroundWorker = CType(sender, BackgroundWorker)
Dim i As Integer
For i = 0 To count - 1
Try
If (SubmitThread.CancellationPending = True) Then
e.Cancel = True
Exit For
Else
'My code to handle each checked item in the listbox
Catch ex as Exception
msgbox(ex.message)
End If
End Try
submitworker.ReportProgress(0, detailshere)
Next
End Sub
Any help here would be appriciated