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
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();
精彩评论