Change textbox value inside event?
<p>I have scanner event when this event occur I have code to save what I read it by scanner to textbox .</p>

<p>When I am tracing this it is work fine but nothing showing on the screen for user </p>

<p>This code inside button click: </p>

<pre><code>  protected void Button1_Click(object sender, EventArgs e)
    {
        try
        {
            //Instantiate CoreScanner Class
            cCoreScannerClass = new CCoreScannerClass();
            //Call Open API
            short[] scannerTypes = new short[1];//Scanner Types you are interested in
            scannerTypes[0] = 1; // 1 for all scanner types
            short numberOfScannerTypes = 1; // Size of the scannerTypes array
            int status; // Extended API return code
            cCoreScannerClass.Open(0, scannerTypes, numberOfScannerTypes, out status);
            // Subscribe for barcode events in cCoreScannerClass
            cCoreScannerClass.BarcodeEvent += new
            _ICoreScannerEvents_BarcodeEventEventHandler(OnBarcodeEvent);
            // Let's subscribe for events
            int opcode = 1001; // Method for Subscribe events
            string outXML; // XML Output
            string inXML = "&lt;inArgs&gt;" +
            "&lt;cmdArgs&gt;" +
            "&lt;arg-int&gt;1&lt;/arg-int&gt;" + // Number of events you want to subscribe
            "&lt;arg-int&gt;1&lt;/arg-int&gt;" + // Comma separated event IDs
            "&lt;/cmdArgs&gt;" +
            "&lt;/inArgs&gt;";
            cCoreScannerClass.ExecCommand(opcode, ref inXML, out outXML, out status);
            Console.WriteLine(outXML);

        }
        catch (Exception exp)
        {
            Console.WriteLine("Something wrong please check... " + exp.Message);
        }
    }
</code></pre>

<p>This code after event occur :</p>

<pre><code>void OnBarcodeEvent(short eventType, ref string pscanData)
{
    first = pscanData;
      printfunction();

        }
</code></pre>

<p>this code after printfunction function to write to textbox  :</p>

<pre><code>private void printfunction()
    {
        int l = first.IndexOf("&lt;datalabel&gt;");
        second = first.Substring(l + 11);
        int j = second.IndexOf("&lt;/datalabel&gt;");
        second = second.Substring(0,j-1);

        string newValue = second.Replace("0x", ""); ;
        newValue = newValue.Replace(" ", string.Empty);
        txt = GetStringFromAsciiHex(newValue);
       TextBox1.Text = txt;
     }
</code></pre>

<p>Please help me. Thank you.</p>
