Click to See Complete Forum and Search --> : DBGrid columns and getting data out
Caro
Aug 30th, 1999, 11:00 AM
How do I add or delete DBGrid columns - also when I double click on a DBGrid line I want to be able to put information from a column on the line I've clicked into a string - I know this sounds easy but I've not dome it before and have tried a few things without success - thanks
DVint
Aug 30th, 1999, 08:40 PM
I used the VB5 DBGrid extensively in my last app. Some of its shortcomings didn't become apparent to me until after I'd already delivered the app to the client, but I digress.
The means to add or remove columns in a DBGrid is fairly well hidden. Right click on the DBGrid and a popup menu appears. Choose Edit from this menu and then you can delete, insert and append columns. I would try to give you more detailed info than this, but it would probably just be confusing. What I'd do is just start a blank project with a DBGrid in it and start doing trial and error until you get the feel of it. That way you won't wind up destroying what you have set up.
As to getting at data in the grid: you can use the Columns method. DBGrid1.Columns(0) references the data in the first field of the current row. Columns(1) is the next field, and so on. The current row is available as the Row property: DBGrid1.Row, and you can manipulate that directly in code.
Caro
Aug 30th, 1999, 09:39 PM
Thanks a lot - its obvious once you know how - that was driving me crazy
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.