Populating a form’s textbox with data from a second form
<p>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). </p>

<p>I have listed what I believe to be the significant  parts of the code below.</p>

<p>Form#1:</p>

<pre><code>//Resetting the manually adjusted 'gusBundlesPlacedOnPallet' parameter
if (gusBundlesInRow &gt; 0)
{
    gusBundlesInRow = 0;
    //Update the 'BundlesOnPallet' display on the 'Manual Page' frmManualMode ManualMode = new frmManualMode();           
    ManualMode.NoOfBundlesInPalletizerDisplay(Convert.ToString(iIncomingMsg[15]));
}//End-if
</code></pre>

<p>Form#2:</p>

<pre><code>//Creating a NoOfBundlesInPalletizer Delegate
public delegate void NoOfBundlesInPalletizerDisplayDelegate(string sMessage);
public void NoOfBundlesInPalletizerDisplay(string sMessage)   
{      
    if (txtBundlesInPalletizer.InvokeRequired)   
    {
        Invoke(newNoOfBundlesInPalletizerDisplayDelegate(NoOfBundlesInPalletizerDisplay), new   object[] { sMessage });
    }//End-if
    else
    {
        this.txtBundlesInPalletizer.Text = sMessage;
    }//End else-if
}//End method NoOfBundlesToPalletizeDisplay
</code></pre>

<p>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.  It looks to me that I need some kind of “refresh” of the  textbox value?</p>

<p>Can anyone tell me what I’m doing wrong?</p>

<p>Thanks in advance</p>

<p>Terje </p>
