开发者

Textbox.text is not getting filled, C#

开发者 https://www.devze.com 2023-01-21 19:35 出处:网络
i\'m building a win App and in that, i\'m having a textBox which is get filled dynamically, and i have a checkBox, when checkBox.Checked=true all the message boxes in my app will get pop\'d

i'm building a win App and in that, i'm having a textBox which is get filled dynamically, and i have a checkBox, when checkBox.Checked=true all the message boxes in my app will get pop'd

(not all at a time, just confirmation msg's whereever i hv coded it, one by one).

my problem is when checkBox is checked, my TextBox.Text is getting filled its data but when that checkBox is unchecked, TextBox.text is not getting filled with data, wierd thing is when i tried to debug it, TextBox.Text is showing the text, but on gui TextBox.Text is not filled, now where`s data ?

public void Recharge()
{
  txtTransactionMsgDelegate(Tm) // this is delegate function which fills the text
                               //textbox.text=tm;   i tried this one too,but no use

}
if (Program.AutoManual == "Auto")
{
   if (chkShowMsg.Checked)
   {
        if (returnRows < 1)
            MessageBox.Show(Program.StatusMessage + " But Local Db Failed, NOTEDOWN IN NOTEBOOK");
        else
            MessageBox.Show(Program.StatusMessage + " And Local Db update SuccessFul, RUN UPDATE RECHARGE LATER");
    }
}

Delegate Function:

// m using this delegate b'co开发者_如何转开发z my above function i.e Recharge() is under BackGroundWorker Thread i.e BackGroundWorker_DoWork() event;
private void txtTransactionMsgDelegate(string Text)
{
   if (txtTransactionMsg.InvokeRequired)
   {
      txtTransactionMsg.Invoke(new Action(delegate() { txtTransactionMsgDelegate(Text); }));
   }
   else
     txtTransactionMsg.Text = Text;
 }


To make sure the textbox is updated on the GUI you should call txtTransactionMsg.Refresh();

0

精彩评论

暂无评论...
验证码 换一张
取 消