Hi Im trying to Populate my datagridview from data scraped off of webpage i Want to be able to report progress when datagrid finished updating.. with a progressbar.. Please Help!!!!!! Thank You.. Heres My code Dim theElementCollection As Windows.Forms.HtmlElementCollection theElementCollection = Form1.WebBrowser2.Document.GetElementsByTagName("a") For Each curElement As HtmlElement In theElementCollection Form1.DataGridView1.Rows.Add(curElement.GetAttribute("title"), (curElement.GetAttribute("href"))) Dim numberOfRows = Form1.DataGridView1.Rows.Count - 1 Dim i As Integer = 0 While i < numberOfRows - 2 For ii As Integer = (numberOfRows - 2) To (i + 1) Step -1 If Form1.DataGridView1.Rows(i).Cells(0).Value.ToString() = Form1.DataGridView1.Rows(ii).Cells(0).Value.ToString() Then Form1.DataGridView1.Rows.Remove(Form1.DataGridView1.Rows(ii)) numberOfRows -= 1 End If Next i += 1 End While …

Member Avatar
Member Avatar
+0 forum 2

I'm using Excel interop and it seems that this functionality needs to run in the User Interface thread. So I execute that from the ProgressChanged backgroundworker event. Is there a way to have the dowork event (that invoked the progress changed event) interrupt execution until the ProgressChanged event is finished? Here's how the bg is initialized: private void initializeBackgroundWorker() { bg36 = new BackgroundWorker(); bg36.DoWork += bg36_DoWork; bg36.RunWorkerCompleted += bg36_RunWorkerCompleted; bg36.WorkerReportsProgress = true; bg36.ProgressChanged += bg36_ProgressChanged; bg36.WorkerSupportsCancellation = true; } This is how the process is started: private void bg36_DoWork(object sender, DoWorkEventArgs e) { BackgroundWorker bw = (BackgroundWorker)sender; This is …

Member Avatar
Member Avatar
+0 forum 3

I have developed an application that loaded many images in a listview using ImageList in c# .net framework 4. The images are also compressed. When many many images are loaded and compressed then it takes a long time. So I call the method in backgroundworker. In the backgroundworker I had to add images to ImageList and add ImageList to ListView. So I have used safeinvoke() method listView1.SafeInvoke(d=>d.Items.Add(item)). Everything works fine. Images are displayed one by one in the listview. But the release of the application doesn’t work properly in some pc and properly works in some other pc. Doesn’t work …

Member Avatar
Member Avatar
+0 forum 1

there are three methods called in a backgroundworker_dowork() event in c# .net 4. I want to execute three methods synchronously. that is, 2nd method will execute after 1st method is fully executed and 3rd method will execute when 2nd method is fully executed. because 2nd method can exetue properly only when 1st method is fully executed. but in the background worker all three methods are executed asynchronously that i don't want. How to solve it? Thanks in advance.

Member Avatar
Member Avatar
+0 forum 3

You cannot vote on your own post 0 I have loaded many images in a listview using ImageList in c#. When many many images are loaded then it takes a long time. So I call the method in backgroundworker. In the backgroundworker I had to add images to ImageList and add ImageList to ListView. So I have used safeinvoke() method listView1.SafeInvoke(d=>d.Items.Add(item)). . Everything works fine. Images are displayed one by one in the listview. But the problem is the listview is continuously refreshing when a new item is added. This refreshing seems disturbing to the user. When I have added …

Member Avatar
Member Avatar
+0 forum 2

Hi all, I am looking to have a long process running in the background to my main form with a timer ticking on the main form animating the elipsis on the end of some text. Was looking for some insight into the best way to go about this and any decent resources worth reading on the subject, or a starter. Im aware of the BackgroundWorker class so im assuming this will be used but implementation is where im falling down. Cheers,

Member Avatar
Member Avatar
+0 forum 3

Hello... I'm working on an application that contains a "BackgroundWorker", the "BackgroundWorker" worked fine but after I started to change some stuff it gives me an error ("Exception has been thrown by the target of an invocation.")... I used a breakpoint to see where it happens, the exception gets thrown at the "End Sub" line of the BackgroundWorker... I then deleted all the code inside of it and ran it again... I still get the error. -Thanks

Member Avatar
Member Avatar
+0 forum 12

Hi. Guys, I need some help. Does anyone know how to Call cross threads in vb.net while accessing the backgroundworker as well? I keep getting error everytime I run my program... Here is my code: [CODE]Imports System.IO.Directory Imports System.IO Public Class Video_to_Mp3 Public folderopen As String Dim ofd As New OpenFileDialog Dim sizetext As String Dim length As Double Dim proc As New Process 'make it global so dat we can kill it from outside Dim avdcfile As String = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) & "\AVDC Folder\convertlog.txt" Dim filepath As String = "C:\" Dim dirsave As String = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) & "\AVDC Folder\Converted Files\Audio\" …

Member Avatar
Member Avatar
+0 forum 1

hi, i put together this code to read a text file line by line, split the resulting string into the 4 values and send these values to four text-boxes. during each cycle of that while loop it's suppose to initialize the backgroundworker_dowork, which will read the values and use them(and start a long loop and stuff). The first and obvious problem i have is that when i run this i get an error saying that this backgroundworker is already busy and can't handle another task. The part that's supposed to read text works as far as i can tell from …

Member Avatar
Member Avatar
+0 forum 4

I have a form let's call it Form1 that calls another form(Form2) Form2 to has a bit a code that needs to load in the LOAD_EVENT and takes about 4 seconds. I have made a new form(frmProgress) that only has a progress bar. I want frmProgress to show up and load the progress bar meanwhile Form2 is loading. I've tried using BackgroundWorker but I can't seem to get the grasp of it. Can someone please help me out. Thanks. btw i've looked into some tutorials but don't fully understand it.

Member Avatar
Member Avatar
+0 forum 5

Hi Guys, I am developing a VB application along with MS Access... When I initially load my form I need to put my application to sleep for 3 seconds or else data wont load properly. So for this 3 seconds I would like to show a progress bar displaying a message "Please wait..." I tried using background worker but did not find any success... I have gone through many tutorials but for some reason could not accomplish the task... Could you please help me ... Thank you Ashwin

Member Avatar
Member Avatar
+0 forum 4

i have a background worker with a sleep method inside a method. (winforms) here is the code that is executed: [CODE] private void backgroundWorker1_DoWork(object sender, DoWorkEventArgs e) { BackgroundWorker worker = sender as BackgroundWorker; int[] makeSelfMoves = new int[4]; foreach (KeyValuePair<int, int[]> item in replay)// count should be more than 2 { makeSelfMoves = replay[item.Key];// the Dictionary contains all the chess moves, rowStart,columnStart,rowEnd,columnEnd codeFile.ExecuteAll(makeSelfMoves[0], makeSelfMoves[1], makeSelfMoves[2], makeSelfMoves[3]);// this method executes the code. PrintPieces(codeFile.PieceState()); System.Threading.Thread.Sleep(1000); } //PrintPieces(codeFile.FirstTimeLoad()); //PrintPieces(codeFile.PieceState()); }[/CODE] it is being activated by an outside method. [CODE] public void ReplayGame() { Class2.replayIsOn = true; replay=serializeMeh.giveBackDictionary(); if (backgroundWorker1.IsBusy != true) { …

Member Avatar
Member Avatar
+0 forum 11

How to list all files in a folder including subfolder files.

Member Avatar
Member Avatar
+0 forum 9

I need to make a project that takes data from a uC through serial port and insert it in some databases. I want to take the data from 5 sensors, i'm sending the data from al 5 sensors once per hour. The problem is that I want to use backgroundworker for taking the data from serial port, and insert in the database and another backgroundworker for the graphic interface of the program(the graphic interface contain a DataGridView that loads from the database last 200 entries and 5 richtextboxes for instant values of the sensors). Now I have this code: In …

Member Avatar
+0 forum 0

I am running a BackgroundWorker to make a call to a Web Service to obtain a list of Customers, and a list of Vat Rates. This is fine and works, but I am simply stuck passing this data through to RunWorkerCompleted so the form can be updated (these two sets of data populate two combo boxes) [code] private void bwWebServiceCalls_DoWork(object sender, DoWorkEventArgs e) { //Get customers Invoice.Customer[] customers = new Invoice.Customer[0]; customers = this.wsInvoice.getCustomers("user", "pw"); //Get Vat Rates Invoice.Vat[] vats = new Invoice.Vat[0]; vats = this.wsInvoice.getVatRates("user", "pw"); e.Result = ; } [/code] This is incomplete code! If anyone can point …

Member Avatar
Member Avatar
+0 forum 2

Hi, I am loading some pictures from a traffic cam website and displaying them in picture boxes but the form freezes because its working too much. Is there any way to speed up the process, here is my code. [code] string[] picURL = new string[9]; picURL[0] = "http://www.nzta.govt.nz/traffic/current-conditions/webcams/webcam-images/cst1.jpg?rnd=0.0822959104552865"; picURL[1] = "http://www.nzta.govt.nz/traffic/current-conditions/webcams/webcam-images/hel1.jpg?rnd=0.9581611268222332"; picURL[2] = "http://www.nzta.govt.nz/traffic/current-conditions/webcams/webcam-images/hel2.jpg?rnd=0.8423508508130908"; picURL[3] = "http://www.nzta.govt.nz/traffic/current-conditions/webcams/webcam-images/hel3.jpg?rnd=0.800909330137074"; picURL[4] = "http://www.citylink.co.nz/images/webcam/aotea.jpg"; picURL[5] = "http://www.citylink.co.nz/images/webcam/terrace-north.jpg"; picURL[6] = "http://www.citylink.co.nz/images/webcam/terrace-south.jpg"; picURL[7] = "http://www.citylink.co.nz/images/webcam/courtenay.jpg"; picURL[8] = "http://www.citylink.co.nz/images/webcam/mtvic.jpg"; WebRequest Request1 = WebRequest.Create(picURL[0]); WebRequest Request2 = WebRequest.Create(picURL[1]); WebRequest Request3 = WebRequest.Create(picURL[2]); WebRequest Request4 = WebRequest.Create(picURL[3]); WebRequest Request5 = WebRequest.Create(picURL[4]); WebRequest Request6 = WebRequest.Create(picURL[5]); WebRequest Request7 = WebRequest.Create(picURL[6]); …

Member Avatar
Member Avatar
+0 forum 6

The End.