PDA

Click to See Complete Forum and Search --> : DB GRID


geetha74
Jan 20th, 2000, 02:02 AM
Hai friends,

I have some doubts in using DB Grid Control in Visual Basic.I am using VB 5.0 for my project, but VB 6.0 is also loaded in our machine. My backend is MS-Access. My doubts may be silly or very simple, but I don't have anyone to help me and i have tried my level best for that.

1. In an Unbound DB Grid Control (Properties: Datamode- Unbound)
how to assign the total number of columns for the DB Grid. By default it is only 2. In help, it was given as, use the cols property of the DB Grid, but it was available for only MS Flex Grid, and not for DB Grid. What to do?

2. How to change the column caption/heading in case of a bound DB Grid control? It is showing the names of the fields created in the backend.

For eg: In backend, while table creation, i hv given the field name as num_ponumber,
txt_itemname for my reference. But if
this is shown as the column caption
in the DB Grid, it may not look appropriate.

3. How to manipulate or add records to the bound DB Grid Control without using the Allow update property of this control (Property Pages : Allow update - Checked).
If i don't check the allow update property, it is not allowing me to type/enter anything in the DB Grid control.

In the DB Grid, because of this abovesaid property,whatever changes are made are reflected immly in the backend. I want to control the updation of the tables using my code and with the use of DB Grid. How to do that?

Expecting your solution as early as possible,

With regards,
K.Geetha.

netSurfer
Jan 20th, 2000, 02:08 AM
1) You can still use the cols property:

dbgrid1.cols = 6 will set columns to 6
dbgrid1.rows = 4 will set ros to 4

As for the other questions, I wouldn't bind the grid to the database. Then you can write in what ever text you want. You can alow the user to add/edit in the grid but you control what gets written to the databse. I never use bound controls because I want to conrol when and how the database is touched.