How can I display the contents of a datatable in a windows datagrid while
the table is being filled? Here's my summarized code:
delegate void loadAuditFileToTableDelegate();
private void btn_run_Click(object sender, System.EventArgs e)
{
/* In Window form */
loadAuditFileToTableDelegate LoadAuditFileToTable = new
loadAuditFileToTableDelegate(loadAuditFileToTable) ;
LoadAuditFileToTable.BeginInvoke (null, null);
}
private void loadAuditFileToTable()
{
/* Also in Window form */
ZMMatch.Audit zmAudit = new ZMMatch.Audit();
table_auditAddress = zmAudit.OpenAuditAZMFileToView(_SFileName); //
process that takes 2-3 mins. to run
// datagrid.DataSource = table_auditAddress; //this line doesn't seem to
work during a delegate call
}
public DataTable OpenAuditAZMFileToView(string sFileName)
{
/* ZMMatch class
// open file, create table/columns,etc...
sAuditRecord = sr.ReadLine();
while (sAuditRecord != null)
{
/* Parse/process line, fill row, and add row to table. Loop will run
about 500,000 times by adding 500,000 rows */
sAuditRecord = sr.ReadLine();
}
return myTable;
}