• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1341
  • Last Modified:

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.
  • 2
1 Solution
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.
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.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

The 14th Annual Expert Award Winners

The results are in! Meet the top members of our 2017 Expert Awards. Congratulations to all who qualified!

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now