vb.net - Filling DataGridView from BackgroundWorker -
This is the case: After Carlos giving me an example of what I should do, I did this, however Now I have a problem that when I do not even get place in BrakePoint Therefore, my desired thing is filled with my If you need someone else please feel free to tell me the information or code part so that I can solve this problem. thanks, To review some of this After the thread I can tell a few things which I see.
I have a DataGridView form and when I started I should start filling the form
DGV with the
backgroundwalker .
Private Sub FirstSub () adoconn () Me.Enabled = false bw.RunWorkerAsync () Me.Enabled = True End Sub Personal Sub-bw_DoWork (as the object, in the form of e DoWorkEventArgs ) BW handles. DoWork Retarder works as BackgroundWorker = CTYPE (Sender, BackgroundWorker) as DataGridView1.InvokeRequired Then for '// VB 10 you can use an anonymous sub-DataGridView1.Invoke (sub) (bw_DoWork (sender, e)) or else DataBaseLayer. Try FillDTwithSP ("ArticlesSelect", ds_Tables.Articles) Me.DataGridView1.DataSource = ds_Tables.Articles Me.DataGridView1.ClearSelection () Pre-Exception As an Exception Try the other end from the MsgBox (ex.ToString) end, then End Sub
bw_DoWork sub
private sub FirstSub () adoconn () Me.Enabled = false bw. WorkerReportsProgress = True AddHandler bw.DoWork, AddressOf bw_DoWork AddHandler bw.ProgressChanged, AddressOf bw_ProgressChanged Me.Enabled = True End Sub Private Sub bw_ProgressChanged (Sub-send as object, changing progress event by changing progression) DataBaseLayer.FillDTwithSP ("Articles Select ", ds_Tables.Articles). Me.DataGridView1.DataSource = ds_Tables.Articles Me.DataGridView1.ClearSelection () Exception as Exempt MsgBox (ex.ToString) End End Sub Private Sub-bw_DoWork (as the object, in the form of e DoWorkEventArgs) Dim Worker BackgroundWorker = CTYPE (Sender, BackgroundWorker) bw.ReportProgress (Sender, e) Try as End Sub
DataTable And the
DataGridView result is set to
as long as the DT is disabled by all controls on the form. The thing is that when I load this form then all this becomes free again and un-free when it is all right, so there is no effect of
BackgroundWorker .
yes
progress changing events , if you have a representative and use it properly.
Comments
Post a Comment