I have a windows application in which I am using a web reference to show the current SMS balance in the account of a particular user.Here is the code that I am using:
Thread t1 = new Thread(new ThreadStart(ShowWaitMessage));
t1.Start();
XmlNode xmlnde = ws.BSAcBalance(txtLoginId.Text, txtPassword.Text);
string sResponse = xmlnde.ChildNodes[0].InnerXml;
if (sResponse.Contains("Authentication Failed"))
{
t1.Abort();
MessageBox.Show("Invalid login id or password !", "Information", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
}
else
{
t1.Abort();
MessageBox.Show("Total balance in your account is Rs : " + sResponse , "Information", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
}
public void ShowWaitMessage()
{
MessageBox.Show("Please Wait ......");
}
The ws.BSAcBalance is the method that connects the application to the web, it takes some 2 to 3 seconds to execute. In the meanwhile, I want to display a "Please Wait" message for which I am trying to use threading and displaying the message through a message box.Now once the desired operation is completed, I want the "Please Wait" message box to hide, but that doesn't happen.What should I do ?