I am still not able to have the focus on Cancelbutton so that i can click during an asynchronous process takes place.This is the code sample.
I am calling Test() method which will take some time to finish.During that time I wanna click on the cancel button which i am not able to do.
public delegate void AsyncFactorCaller();
public void Test()
for (int i = 0; i <= 1000000000; i++)
public void CallBackTest(IAsyncResult result)
DisplayInfoDelegate del = new DisplayInfoDelegate(Tick1);
AsyncFactorCaller factorDelegate = (AsyncFactorCaller)result.AsyncState;
private void button1_Click(object sender, EventArgs e)
btnCancel.Visible = true;
factorDelegate = new AsyncFactorCaller(Test);
IAsyncResult result = factorDelegate.BeginInvoke(new AsyncCallback(CallBackTest), null);