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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

DBGrid question (Unbound mode)

Status
Not open for further replies.

Brice

Programmer
Dec 16, 2000
22
0
0
US
My original post seems to have fallen way down the list, so I'm posting it again. Also, I have since found out that I need to use the UnboundReadData, UnboundWriteData, and UnboundAddData events to do what I need to do, but I'm still having some trouble. Specifically, I'm having trouble setting bookmarks properly so that the data ends up in the right row in the grid.

Thanks in advance.
Brice


I'm using a DBGrid to display and edit data that is contained in objects within a collection object that is within another object (Whew!) I have no problem getting the data from the objects and putting data into the objects in the collection, but for some reason, I am not able to display/edit more than one row in the grid.

In a sense, what I'm trying to do is replace the normal recordset with a collection that is a encapsulated within another object. Anyway, I guess what I need to know is how do I add new rows to the grid when I come to the last column in the last row of the grid without binding the grid to a recordset?

I'm using VB6, by the way, and would use a DataGrid except that it only has a Bound mode. It doesn't support Unbound which I think is what I need.

Any help is greatly appreciated.
Thanks,
Brice
 
I didn't see your original post, and it's been a while since I've done any work with a grid, but IIRC, the grid raises events to ask you for more data. You supply it with some from your collection of objects.

The tricky part with the bookmarks (and I don't exactly recall how this worked) is you had to remember the bookmark of the first visible row. When the grid notifies you that it wants data off the visible part of the screen, you use your saved bookmark to calculate which element in the collection it should get.

Jeeze, I'm really screwing this post up. Maybe someone else can answer who's used a grid in the last few months.

First thing to go besides your short-term memory when you get old is, uhhhhh, I forget.
:)

Chip H.
 
:cool: Actually, that does help some. I didn't realize you had to keep track of the bookmark of the first visible row. I'm sure this would probably be easier if I used data controls and recordsets, but for what I'm doing, it would actually probably be more work. Thanks for the help.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top