Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Clearing a Flexgrid in VB 6.0

Status
Not open for further replies.

kmfna

MIS
Joined
Sep 26, 2003
Messages
306
Location
US
Hey guys,

I'm working with a flexgrid that I am having some problems re-using. After I query a database I manually populate the grid from the recordset (no datasource stuff). When I need to requery the DB, I am using "FG_Report.clear" and then "FG_Report.refresh". I thought that this would clear the grid and reset it...however, when I query again, the grid starts populating from where it last left off...there are just a bunch of blank fields where the old info used to be. Any thoughts on how to start loading from the beginning again???

Thanks
Kevin
 
You will need to set the .row and .col property to where you want to start loading the grid again.

Thanks and Good Luck!

zemp
 
Zemp,

Thanks for answering the question, I tried using the .row and .col properties and it did the exact same thing...I'm still not quite sure how that is, because I use them for another use, and it works fine...kind of strange. So, if you can think of some other way, it would be greatly appreciated.

thanks,
Kevin
 
Post your code and we will have a look. Might give us a better idea of what is going on.


Thanks and Good Luck!

zemp
 
Ok, I'll get on that, though I won't have access to my code until Tuesday. So I'll post it as soon as I get to work then.

thanks
Kevin
 
can't you use the .movefirst option to make it go back to the beginning of the data selection?
 
Jim,

the .movefirst would work if I were having issues manipulating the recordset, but the problem is that I am clearing the flexgrid and trying to refill it starting with the first cell. I'll actually be using a new recordset.

Thanks
Kevin
 
You need to loop throught the rows and remove them:

Why not start from scratch?
Either use:

MSHFlexGrid1.Rows=0
or
MSHFlexGrid1.Cols=0

 
Hey guys,

I know I said that I would be posting code today, but my box at work is kinda jacked up...so I'm spending the day fixing it...I should be able to have it up on Thursday, though.

Thanks for everyone's help
Kevin
 
Here is what I use to clear before I repopulate a flexgrid



ModAddGrid.Clear
ModAddGrid.Rows = (1)
ModAddGrid.Cols = (2)
S$ = " Order #| MOD Name"
ModAddGrid.FormatString = S$
ModAddGrid.ColWidth(0) = 0
ModAddGrid.ColWidth(1) = 2800
 
Hey guys....

Thanks for all of the help...I apologize for not thanking you all earlier, but I haven't actually logged in due to all of the trouble shooting crap w/ this computer I've been having to do...(like 15 virii and 97 adware programs!!) I did actually get the issue resolved....so I would like to give special thanks to CClint...I know that it was a decidedly easy fix, but it worked...I can't believe I didn't think of it first...either way, you're a good man. And, actually, by the time I was done, it actually ended up looking like AZRobert's last post, so special thanks to you as well....

Sincerely,
Kevin
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top