a synchronization problem on webservice

W

wx

hi all, I have some problems on a Windows application in .Net Framework,just
as below:
private void button1_Click(object sender, System.EventArgs e)
{

WindowsApplication1.localhost.Service1 ser=new
WindowsApplication1.localhost.Service1();
textBox1.Text=ser.Add(int.Parse(textBox1.Text),1).ToString();
MessageBox.Show("ok");

}
you know, A webservice named ser is called in the above function,and ,when
the main form is loaded for the first time,if I click the button1 on the
form very quickly,the awful thing would happen:a messagebox is showed,when I
close it ,another messagebox is opened,I continue closing, and the same
thing happen:a messagebox is showed.The number of messageboxes is according
to the speed of my mouse clicking.

so, it seems the button1 still accept the click event while a webservice is
being called for the first time.But I expect only one messagebox would be
showed even though I click very quickly.How to control? hope your help!!!
Thank you!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,535
Members
45,007
Latest member
obedient dusk

Latest Threads

Top