Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
friends i hav doubt in vb, pls help!
when a user clicks on a particular cell, i want to get the column and row of that cell.
for ex. (1,1) or (4,9)
and how can i make mshflexgrid cells editable, ie user can edit & enter some value
pls reply

If your control is named "Flex"...
To get the column and row, and then to let the user enter/edit the value, the following snippet should be enough to get you started...
Private Sub Flex_Click()MsgBox "(" & Flex.Col & "," & Flex.Row & ")"
Flex.Text = InputBox("Enter Value", "New Value", Flex.Text)
End Sub
Not sure if you can edit directly within the cell...

lets keep control name is flex
when i give command
msgbox(flex.row) it works and give me the currrently pressed row
but the command msgbox(flex.col) works but always it gives the result as 1.
one more thing, when
msgbox(flex.row) is written it changes to
msgbox(flex.Row), r change to capital r b'coz it Defined in flexgrid
but the same thing doen't happen with col
msgbox(flex.col) remain to flex.col
but other col property works.
so plz reply.
anyway thanks for ur response

Don't know what to tell you... yours isn't behaving like mine. I'm using VB6 with ServicePack 5. Maybe you have a different version. If you don't have a .col property, you should be getting an error instead of always a value of 1.
Check your help for the flexgrid control. Maybe you need different syntax.

Thanx for ur reply
But i checked for the command, but it is the same.
Ok, can u say me how to connect DBGrid to backend(access) -- programmitically
Pls reply
bye

Well, I've never used the DBGrid, but I just played with it for a minute and it looks like you'd do something along the lines of:
-create a database using Access.
-add a data control to your form (not the ADO one, though).
-set the "DatabaseName" property
-set the "RecordSource" property to the table you want-add the DBGrid to your form
-set its "DataSource" property to the name of the data controlThat's enough to get you started. Have fun.

Hey HiJinx, u r saying to use datacontrol, but i want to use only datagrid nothing else.
And i tried to do with datacontrol too, but when iam setting database in desgin time it so some error as invalid database.
Iam connecting to Access.
Note: that connect property of Data Control is Access

You could maybe try Access 2000 from the drop down list instead of just Access. But whatever problems are preventing you from connecting the db with the data control are likely to come back if you try connecting through code.
Sorry I couldn't have been of more help.

![]() |
Convert a ( .BMP) into bi...
|
Run java apps by double-c...
|

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |