Hi,

I have faced a similar problem in the past and I solved this by thinking about this a bit differently. I found that trying to wait for the cancellation of a background thread could take a variable amount of time depending on the data being loaded and I always ended up duplicating data and messing up the UI similar to what you are experiencing now.

To get round this, and to let the User scroll through options as fast as they wanted to, I decided that I needed to let the Background Thread finish its current work before trying to get it to do something else. The trick here was to make sure that the UI Thread continued to keep track of what the user was doing, doing minimal work on the UI Thread, and then only processing the LAST Selected Option once the Background Thread became available again. I achieved this by adding each selected user option to a Stack and then once the Background Thread became available the LAST item on the Stack was retrieved and processed on the background thread.

Here’s a quick example using a bunch of TextBox’s on a form. Just run the cursor over the TextBox’s as quick as you want and you will see that only the last textbox is processed when the Backgoundworker becomes free. Maybe you can adapt this idea to your Carousel problem.

vb.net Code:
  1. Public Class Form1
  2.   Private carouselStack As New Stack(Of String)
  3.  
  4.   Private Sub Button1_Enter(sender As Object, e As EventArgs) Handles Button1.MouseEnter, Button2.MouseEnter, _
  5.     Button3.MouseEnter, Button4.MouseEnter, Button5.MouseEnter, Button6.MouseEnter, Button7.MouseEnter
  6.  
  7.     carouselStack.Push(sender.name)
  8.     If Not BackgroundWorker1.IsBusy Then
  9.       BackgroundWorker1.RunWorkerAsync()
  10.     End If
  11.   End Sub
  12.  
  13.   Private Sub BackgroundWorker1_DoWork(sender As Object, e As System.ComponentModel.DoWorkEventArgs) Handles BackgroundWorker1.DoWork
  14.     'do some labour intensive work
  15.     Dim lastCarouselSelection As String = carouselStack.Pop
  16.     carouselStack.Clear()
  17.     Label1.Invoke(Sub()
  18.                     Label1.Text = String.Format("Processing Button {0}", lastCarouselSelection)
  19.                   End Sub)
  20.     Threading.Thread.Sleep(2000)
  21.   End Sub
  22.  
  23.   Private Sub BackgroundWorker1_RunWorkerCompleted(sender As Object, e As System.ComponentModel.RunWorkerCompletedEventArgs) Handles BackgroundWorker1.RunWorkerCompleted
  24.     If carouselStack.Count > 0 Then
  25.       BackgroundWorker1.RunWorkerAsync()
  26.     End If
  27.   End Sub
  28. End Class

Hope that helps.

Cheers,

Ian