Reputation: 3911
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'coz 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;
}
Upvotes: 2
Views: 1064
Reputation: 3110
To make sure the textbox is updated on the GUI you should call txtTransactionMsg.Refresh();
Upvotes: 2