473,385 Members | 2,013 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

background worker

145 100+
When I run my old sync button right away I get 0 update or 20 updates. but with the bg worker it takes long time whether for 0 record or 100 records. I think the problem is with the upper number ( For i As Integer = 1 To 100). Shouldnt the 100 be the actual # of records the class is updating. Please suggest.

here is my class
http://www.e-topco.com/scriptlance/syncslip_2.txt

[SIZE="1"]
Expand|Select|Wrap|Line Numbers
  1. Dim objMySlip As New clsSyncSlip()
  2.      Dim sResult As Integer
  3.      sResult = objMySlip.syncSlipNew(cSessionID)
  4.      MsgBox("Total " & sResult & " slip(s) have been updated")
  5.  

Expand|Select|Wrap|Line Numbers
  1.     Private Sub btnSyncNew_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSyncNew.Click       
  2.         Me.BackgroundWorker1.RunWorkerAsync()
  3.     End Sub
  4.  

Expand|Select|Wrap|Line Numbers
  1.     Private Sub BackgroundWorker1_DoWork(ByVal sender As System.Object, ByVal e As System.ComponentModel.DoWorkEventArgs) Handles BackgroundWorker1.DoWork
  2.         Dim worker As System.ComponentModel.BackgroundWorker = DirectCast(sender, System.ComponentModel.BackgroundWorker)
  3.         For i As Integer = 1 To 100
  4.             'Raise the ProgressChanged event in the UI thread.
  5.             worker.ReportProgress(i, i & " iterations complete")
  6.             'Perform some time-consuming operation here.
  7.             Dim cSessionID = Me.txtSessionID.Text
  8.             Dim objMySlip As New clsSyncSlip()
  9.             Dim sResult As Integer
  10.             sResult = objMySlip.syncSlipNew(cSessionID)
  11.             'MsgBox("Total " & sResult & " slip(s) have been updated")
  12.             Threading.Thread.Sleep(0)
  13.         Next i
  14.         MsgBox("done")
  15.     End Sub
  16.  
[/SIZE]
Jun 10 '08 #1
0 822

Sign in to post your reply or Sign up for a free account.

Similar topics

7
by: bryanjhogan | last post by:
Hi all, I have a GUI application that uses timers -------------------- TimerCallback readDelegate; TimerCallback deleteDelegate; private Timer readTimer; private Timer deleteTimer;
1
by: bilosta | last post by:
I need help with background worker and form I have a class (form1) that works with database. I need this: -Show form2 while form1 is geting data from database -When form1 is done, close form2,...
7
by: John J. Hughes II | last post by:
I have a DataGridView with a TextBoxColumn. I setting the data source to a List<stringvalue in a static class. The list is filled from a background thread. So far all is fine and it works...
6
by: sjoshi | last post by:
I'm able to use the Bacground Worker class to execute task and pain the UI. However I want to be able to execute n tasks in order, say n1, then n2 if there were no errors during n1, n3 so on. ...
8
by: =?Utf-8?B?R3JlZyBMYXJzZW4=?= | last post by:
I'm trying to figure out how to modify a panel (panel1) from a backgroundworker thread. But can't get the panel to show the new controls added by the backgroundwork task. Here is my code. In...
4
by: Jesse Aufiero | last post by:
I'm wondering what the rule is on how to assure that the background worker 'DoWork' routine is truly running entirely in the background. My DoWork routine calls another procedure which resides in...
4
by: csharpula csharp | last post by:
Hello, Can you please tell me if I should use the background worker in the following way: if (worker.IsBusy) worker.CancelAsync(); (or I can avoid this if)? And in case I want to restart the...
7
by: csharpula csharp | last post by:
Hello, I got a question regarding the usage of background worker. How can I run few threads via background worker with different objects as parameter each time. I understood that I can't do...
2
by: thoffman | last post by:
Hello again everyone! I have an issue that I can't seem to find a straight answer for anywhere... I have a For loop that sends a file name to a background worker that contains some long running...
1
by: Infog | last post by:
I am trying to code a simple background workers class without needing to use the backgroundworker object on a form. This would allow me to use a background worker in any class without writing much...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.