I have a module that is doing several things. As each thing is started I want to update a label on the main form with some text.
Doing this in vb.net is absolutely no problem. For some reason, however, C# doesn't work the same way.
Developer forums have said to do a form Update() or an Application.DoEvents() after updating it.
Well I have gone even further than that. I have a public method on my form that looks like this:
public void updateStatusDisplay ( string strMessage )
{
lblPleaseWait.Text = strMessage;
this.Update ();
Application.DoEvents();
}
Then in the module that is performing the processes:
frmRptSel_AcctMgrAvg newReport = new frmRptSel_AcctMgrAvg(myCodeTables);
newReport.updateStatusDisplay ( "Report: Pending Inventory" );
The updateStatusDisplay method is being called (I set a breakpoint in it), but the display doesn't update. What the heck is going on???
Why did Microsoft make the behaviour of C# be so different than vb.net in this? In VB, all I have to do in the module is: frmRptSel_AcctMgrAvg.lblPleaseWait.Text = "new text" and the form is updated and you can see it change. I even do something like this utilizing a progress bar in VB the same way. All I have to do is: frmRptSel_AcctMgrAvg.progressBar1.PerformStep()
Thanks in advance,
Jerry Scannell
Doing this in vb.net is absolutely no problem. For some reason, however, C# doesn't work the same way.
Developer forums have said to do a form Update() or an Application.DoEvents() after updating it.
Well I have gone even further than that. I have a public method on my form that looks like this:
public void updateStatusDisplay ( string strMessage )
{
lblPleaseWait.Text = strMessage;
this.Update ();
Application.DoEvents();
}
Then in the module that is performing the processes:
frmRptSel_AcctMgrAvg newReport = new frmRptSel_AcctMgrAvg(myCodeTables);
newReport.updateStatusDisplay ( "Report: Pending Inventory" );
The updateStatusDisplay method is being called (I set a breakpoint in it), but the display doesn't update. What the heck is going on???
Why did Microsoft make the behaviour of C# be so different than vb.net in this? In VB, all I have to do in the module is: frmRptSel_AcctMgrAvg.lblPleaseWait.Text = "new text" and the form is updated and you can see it change. I even do something like this utilizing a progress bar in VB the same way. All I have to do is: frmRptSel_AcctMgrAvg.progressBar1.PerformStep()
Thanks in advance,
Jerry Scannell