|
-
November 24th, 1999, 12:37 AM
#1
Bound DBGrid: How find out Row Selection , and one more problem
In Bound DbGrid, a row can be selected by clicking on the First Column ( where it displays '>' ). Now how do i know that a row has been selected? Say i want to allow "Select" btn only after a row has been selected?
I Cannot depend on the underlying record set objects current record, because there will be a valid record even if i click on any of the columns.
ANd i Dont want to set the mode to select the entire row on click anywhere .
2. MSDN Docs say SelStartRow and SelEndRow are defined for DBGrid. But i dont see those properties in a bound DBGrid. Is that because it is bound?
3. IF i want to make one of the colums (ie Filed on the underlying recset ) not visible ( and hence not editable by user) how can i do it? Is sql the only way out?
Answers for any/all of the questions will be rewarded with Points :-)
RK
RK
-
November 24th, 1999, 03:08 AM
#2
hint for question no 3
have you tried the LayOut tab in the properties dialog of the dbgrid?
there is a "visible" check box. if you click it "off", the column is invisible.
-
November 24th, 1999, 03:14 AM
#3
hint for question 1
there is a SelChange Event that seems to be triggered whenever a different row is clicked in the first column of a row.
-
November 24th, 1999, 03:18 AM
#4
hint for question 2
I just created a dbgrid in vb 6.
to get the selected rows:
grid.selbookmarks.count tells you the number of selected (=marked) rows
grid.selbookmarks.item(0) the row number ot the first selected row and so on...
-
November 24th, 1999, 03:31 AM
#5
Re: hint for question 1 Thans a lot!
Thanks a lot Lother.
I dont know how i missed this!... like they say when you are too keen to do something, you will miss the bigger picture!:-)
BTW, SelChange triggers for both Row and Col header click, this coupled with .SelStartCol and SelEndCol can be used to deferentiate between them, i think
Thanks again
RK
-
November 24th, 1999, 03:47 AM
#6
Re: hint for question 2
This point i had noticed after posting. I was banking on this with a timer event...etc
For a Bound Grid the SelBookMarks count always seems to be 1 or 0, because they inturn represent current record and you cant have more than 1.
I couldn't use the Layout because the no. of cols is not const and the record set is set at run time... i found out that we can use the Columns collection & COlumn property to set this. Both Visibility and Width.
But that leaves out one more problem i posted yeterday: How to get the height of the fixed row ?!
Thanks again.
RK
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|