The application has two forms. The main form (Form#1) utilizes threading. One of these threads is used for reading in parameters from a TCP/IP socket. Once the value of one specific parameter has changed, I want to display this new value in a textbox on the second form (Form#2). I have listed what I believe to be the significant parts of the code below.
Form#1:
//Resetting the manually adjusted 'gusBundlesPlac edOnPallet' parameter
if (gusBundlesInRo w > 0)
{
gusBundlesInRow = 0;
//Update the 'BundlesOnPalle t' display on the 'Manual Page' frmManualMode ManualMode = new frmManualMode() ; ManualMode.NoOf BundlesInPallet izerDisplay(Con vert.ToString(i IncomingMsg[15]));
}//End-if
Form#2:
//Creating a NoOfBundlesInPa lletizer Delegate
public delegate void NoOfBundlesInPa lletizerDisplay Delegate(string sMessage);
public void NoOfBundlesInPa lletizerDisplay (string sMessage) {
if (txtBundlesInPa lletizer.Invoke Required)
{
Invoke(newNoOfB undlesInPalleti zerDisplayDeleg ate(NoOfBundles InPalletizerDis play), new object[] { sMessage });
}//End-if
else
{
this.txtBundles InPalletizer.Te xt = sMessage;
}//End else-if
}//End method NoOfBundlesToPa lletizeDisplay
The textbox on Form#2 will not show the new value, although if I insert a break point just after I have assign the new value to the textbox (sMessage), it does contain the correct value.
Additionally, if I close the second form and then reopen it, it will show the correct value.
Can anyone tell me what I’m doing wrong?
Thanks in advance
Terje
Form#1:
//Resetting the manually adjusted 'gusBundlesPlac edOnPallet' parameter
if (gusBundlesInRo w > 0)
{
gusBundlesInRow = 0;
//Update the 'BundlesOnPalle t' display on the 'Manual Page' frmManualMode ManualMode = new frmManualMode() ; ManualMode.NoOf BundlesInPallet izerDisplay(Con vert.ToString(i IncomingMsg[15]));
}//End-if
Form#2:
//Creating a NoOfBundlesInPa lletizer Delegate
public delegate void NoOfBundlesInPa lletizerDisplay Delegate(string sMessage);
public void NoOfBundlesInPa lletizerDisplay (string sMessage) {
if (txtBundlesInPa lletizer.Invoke Required)
{
Invoke(newNoOfB undlesInPalleti zerDisplayDeleg ate(NoOfBundles InPalletizerDis play), new object[] { sMessage });
}//End-if
else
{
this.txtBundles InPalletizer.Te xt = sMessage;
}//End else-if
}//End method NoOfBundlesToPa lletizeDisplay
The textbox on Form#2 will not show the new value, although if I insert a break point just after I have assign the new value to the textbox (sMessage), it does contain the correct value.
Additionally, if I close the second form and then reopen it, it will show the correct value.
Can anyone tell me what I’m doing wrong?
Thanks in advance
Terje