hello, i have 3 questions about AdvGrid component
1.How to connect AdvGrid with the DataSource.DataSet component from the property of the AdvGrid control, not the code
now i do it like this (code)
AdvGrid-> DataSource = MyDataSource;
and it currently works
but if I want to set the DataSource property on AdvGrid and enter there e.g. MyDataSource I immediately get an error
I'll just mention that I keep my MyDataSource on other form than AdvGrid.
-
When I close the form and want to enter it again, they immediately get an error. this is probably due to the fact that I am not closing / clearing DataSrouce. How to do it? no such method, eg AdvGrid-> DataSource-> Clear (); or something like that
-
is it possible to filter records on AdvGrid using ComboBox
I suspect these questions concern TDBAdvGrid?
It should be possible to change the datasource at any time but it is important of course that it is a valid instance of a datasource. Please verify this.
I would need more detail about the open/close. Without any detail, it is hard to guess what is wrong.
For filtering data in the grid itself (and not via the dataset), set grid.PageMode = false and see all filtering capabilities in the grid from page 104 http://www.tmssoftware.biz/download/manuals/TMS%20TAdvStringGrid%20Developers%20Guide.pdf
Yes it's TDBAdvGrid
about connection
I have two forms
Form1 and here I have TDBAdvGrid (name: AdvGrid1)
and
FormDB and here I have DataSource (name: DataSource1) I use to connect to DB
In Form1::FormShow I have code:
AdvGrid1->DataSource = FormDb->DataSource1;
and It's working fine and data showing on the grid
but when I close the form1 and open it again I got error: Project Proj_name raised exception class $C00000005 with message 'access violation at 0.0001234: read of address 0x0001234'
about filtering
on Form1 I have AdvGrid (AdvGrid1) and ComboBox1
I have a "status" column on the AdvGrid1 and I would like it to work in such a way that changing the value in the ComboBox1 (event: OnChange) filters the grid by the status column.
Is the FormDB instance existing with an existing datasource at all times during your creation of form1?
For the filtering, there are 2 options
- dbgrid.PageMode = true -> you apply the filtering on the dataset and the dbgrid will reflect it
- dbgrid.PageMode = false -> you use dbgrid.Filter.Add and set the filter condition (filtering is explained from page 104 in http://www.tmssoftware.biz/download/manuals/TMS%20TAdvStringGrid%20Developers%20Guide.pdf)
Is the FormDB instance existing with an existing datasource at all times during your creation of form1?
YES
Then I cannot see a reason for this.
Please try to isolate this and send us a sample source project with which we can reproduce the problem here.