BackgroundWorker is going to unresponsive!!
hi,
i need create windows form monitor backgroundworker process.
using (backgroundworker worker = new backgroundworker()) { if (worker.isbusy != true) { worker.workersupportscancellation = true; worker.dowork += backgroundworker1_dowork; worker.runworkercompleted += backgroundworker1_runworkercompleted; worker.runworkerasync(); } }
this backgroundworker process update datagrid's datasource property frequently.
for testing wrote bellow,
datatable dt = (datatable)datagridview1.datasource; (int = 0; < 50; i++) { if (dt == null) { dt = getdatatable(); } else { dt.merge(getdatatable()); } }
getdatatable method return datatable static row.
after completion of do_work event windows form going unresponsive mode.
can 1 please me fix this?
thanks, srini :)
the backgroundworker works on different thread ui , have use invoke or dispatcher ui update.
look @ using dependency properties bond grid , when update grid's datasource changes reflected.
http://msdn.microsoft.com/en-us/magazine/cc163328.aspx
Visual Studio Languages , .NET Framework > Visual C#
Comments
Post a Comment