Cacel Populating Spread Control

I am using Farpoint Spread control to populated the data and i am using VB 6.0 and ADO. Before i poulate the spread control i am using aynchronus connection becuase i am getting 15 to 20 thousand records. And i am using my Spread control in virtual mode. I am calling a routine in Form_Load event to do all this. Briefly the code loooks like this

I have all connectionstring and variable declarations.

Set cnn_Rinfo = New ADODB.Connection
   cnn_Rinfo.Open gConnStr$, , , adAsyncConnect   'here setting the connection for asynchronous
While (cnn_Rinfo.State = adStateConnecting)
   'here i am setting up the fpspread sheet maxrows after getting the total number of records
    fpSpread.VirtualMaxRows = gcount
    ' Set the max number of rows or records to keep in memory
    fpSpread.VirtualOverlap = gcount
    fpSpread.VirtualRows = gcount
    fpSpread.VirtualMode = True
    fpSpread.VirtualScrollBuffer = False
    fpSpread.VScrollSpecial = True
   With Adodc1    
       .ConnectionString = gConnStr$
       .RecordSource = ssql
   End With
   Set fpSpread.DataSource = Adodc1

I want user to have control to stop the process at anystage by showing a form with "cancel button". I do not know exactly how to do this. If anyone knows how to do this please let me know. I hope i explained well what my problem is.
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

U add a Doevents before the code

   Set fpSpread.DataSource = Adodc1
 and after the Code another DoEvents.
  and even place a Doevents in the Cancel Button as the first code in the button click control. This will Solve u'r problem.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Venkat try this code if it not works get back to me , Meanwhile i try with other possibilities.

svenkatapuramAuthor Commented:

Thank you  for your answer. But still i am not able to have control to cancel while populating the spread control. The only way i thought i can do is running the spread control in virtual mode, and setting the virtual rows property to 100. But if i set like this it is populating the srpead control only with 100 records and even if i click the scroll bar it is not showing the next 100 records. If you know anything let me know.

It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.