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 'gusBundlesPlacedOnPallet' parameter
if (gusBundlesInRow > 0)
{
gusBundlesInRow = 0;
//Update the 'BundlesOnPallet' display on the 'Manual Page' frmManualMode ManualMode = new frmManualMode(); ManualMode.NoOfBundlesInPalletizerDisplay(Convert. ToString(iIncomingMsg[15]));
}//End-if
Form#2:
//Creating a NoOfBundlesInPalletizer Delegate
public delegate void NoOfBundlesInPalletizerDisplayDelegate(string sMessage);
public void NoOfBundlesInPalletizerDisplay(string sMessage) {
if (txtBundlesInPalletizer.InvokeRequired)
{
Invoke(newNoOfBundlesInPalletizerDisplayDelegate(N oOfBundlesInPalletizerDisplay), new object[] { sMessage });
}//End-if
else
{
this.txtBundlesInPalletizer.Text = sMessage;
}//End else-if
}//End method NoOfBundlesToPalletizeDisplay
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