progress bar issue

jamie123

Well-known member
Joined
May 30, 2008
Messages
82
Programming Experience
Beginner
I'm using vs2008 programming in vb.net. I'm currently working on a project that reads miscellaneous text files and imports data into a sql database accordingly (Reads line, imports, loops until finished). There are 75k-150k imports to do. I tested it out the other day before using a progress bar, it takes about 5-10 minutes and works fine.

The issue I have is that while importing, if you click anywhere on the form, it will say not responding and will continue to import, but users using the program might be mistaken and think the program has locked up. I thought a progress bar would solve this, since it is responding back while the imports are going on in the background. However, the progress bar works, but as soon as you click anything on the form, it again says not responding and the progress bar stops moving (the imports will complete however). How can I isolate this import process so it can do this in the background, but will not affect the rest of the program?

Thanks!
 
BTW, would anyone mind explaining the code that anthony presented to me?

Private Delegate Sub SetProgressBarDelgate(ByVal Value as integer)

Private Sub SetProgressBar(ByVal Value as integer)
If ProgressBar1.InvokeRequired = True Then
Dim Delegate1 As New SetProgressBarDelgate(AddressOf SetProgressBar)
Dim parameters As ListViewItem
parameters = Value
Me.Invoke(delegate1, parameters)
Else
progressbar1.value = value
End If
End Sub

What is a delegate? And why do the parameters need to be invoked with delegate1?
 
Thanks to the post above me, didn't see it in time. However, i did get the thread stuff working so I'm going to stick to that for now, in the future I think i'll use your method for ease
 
Back
Top