Below is my code. I need the app to run as long as listbox1 is being populated with data (i can't figure this part out).
ThreadPool = button
ProgressIndicator = progressbar
Listbox1 = listbox
Code:Imports System.Threading Public Class MainForm Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load, MyBase.Load, MyBase.Load, MyBase.Load ThreadID.Text &= CStr(Thread.CurrentThread.ManagedThreadId) End Sub Private Sub theLongRunningTask() Do While ListBox1.Items.Count < 50 ProgressIndicator.Style = ProgressBarStyle.Marquee ListBox1.Items.Add("test") Loop ProgressIndicator.Style = ProgressBarStyle.Blocks ProgressIndicator.Value = 0 End Sub Delegate Sub TaskDelegate() Private Sub ThreadPool_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ThreadPool.Click Dim td As New TaskDelegate(AddressOf theLongRunningTask) td.BeginInvoke(Nothing, Nothing) End Sub End Class




Reply With Quote