TDBGrid - Simple Problem, I think??? 
Author Message
 TDBGrid - Simple Problem, I think???

Hi,

    Im currently learning C++ Builder/Delphi and I
    was attempting to write a simplistic application
    that does the following:

    o    Opens a local database/table
    o    Displays the contents of the table in a TDBGrid
    o    When the user clicks on a row in the TDBGrid the
          row number is obtained and the first field in the
          row is referenced.

    With the row number and the first field I will then
    perform some other functionality.

    The program is very simple, however I cant seem to
    get the Row Number or reference the fields when
    the user clicks on the TDBGrid.  I have tried
    referencing the number of selected rows using
    the following:

                DBGrid1->SelectedRows->Count

    But, this always returns 0 (even when I have a row
    selected.  I have configured the TDBGrid such that
    the following options are set:

    dgEditing = false
    dgRowSelect = true
    dgMultiSelect = false
    - the other settings are left as default

    If anyone can help me with this (what must be a simple
    bug) then I would be exceptionally greatful.

    If possible could you please email me directly.

    Best regards,

Spencer Pickett



Wed, 18 Jun 1902 08:00:00 GMT
 TDBGrid - Simple Problem, I think???

To get the Row and Column make your own component

type
    TADBGrid = class(TDBGrid)
    public
        Row;
        Col;
    end;

Now the Rownumber and Columnnumber are visible to your app.
Of course you must register this component.

Success,
Alfred.



Quote:
> Hi,

>     Im currently learning C++ Builder/Delphi and I
>     was attempting to write a simplistic application
>     that does the following:

>     o    Opens a local database/table
>     o    Displays the contents of the table in a TDBGrid
>     o    When the user clicks on a row in the TDBGrid the
>           row number is obtained and the first field in the
>           row is referenced.

>     With the row number and the first field I will then
>     perform some other functionality.

>     The program is very simple, however I cant seem to
>     get the Row Number or reference the fields when
>     the user clicks on the TDBGrid.  I have tried
>     referencing the number of selected rows using
>     the following:

>                 DBGrid1->SelectedRows->Count

>     But, this always returns 0 (even when I have a row
>     selected.  I have configured the TDBGrid such that
>     the following options are set:

>     dgEditing = false
>     dgRowSelect = true
>     dgMultiSelect = false
>     - the other settings are left as default

>     If anyone can help me with this (what must be a simple
>     bug) then I would be exceptionally greatful.

>     If possible could you please email me directly.

>     Best regards,

> Spencer Pickett




Wed, 18 Jun 1902 08:00:00 GMT
 
 [ 2 post ] 

 Relevant Pages 

1. Simple Query problem (I think)

2. Simple problems (I think)

3. Simple (I think) SQL server date/time problems

4. Simple problem..I think

5. Simple I Think

6. Simple (I think) with filtering : (

7. Another simple question (I think so)

8. help with simple(I think!) sql query

9. Simple RollBack Commit Transaction, i think

10. I think its simple

11. Simple Question (I think)

12. I think that is simple Please Help


 
Powered by phpBB® Forum Software