-
Hi,
Can anybody help me get started with the Apex TrueDBGrid control as the TDBG docs are pretty bad! Basically, I've set up a TDBGrid on a form and I've bound it to a Data control. When the form loads, I set the data control's databasename and recordsource properties, then refresh the data control. The Grid then sets up the appropriate columns but they are empty. What am I doing wrong? If somebody could point me in the right direction, I'd be extremely grateful.
Thanks,
Jay
PS - I'm using VB 4
-
did you create a recordset for the data control...
try this...
str = "Select * From TableName"
datacontrol1.RecordSource = str
datacontrol1.Refresh
'where tablname is your table
'make sure the path is set for the datacontrol
'if the grid is bound to the datacontrol and the table
'has data the fields and data will appear
'if not, then right click the grid and select
'clear fields to reset the grid layout
Rob
-
You'd be better off going to the Grid Properties, clicking on the Columns tab and entering the appropriate DataField for each column.
-
The Apex TrueDb grid has diff modes which the developer can use like the Bound, UnBound, Application, Storage modes. The storage mode makes use of the XARRAY object for populating the grid dynamicaly at run time. The XARRAY object has diff properties like UBOUND,BOUND which defines the array bounds of the object. The data can be transfered betweend the grid elements and the XARRAY object to and fro. Get more knowledge on XARRAY object.
-
You don't need to use Storage Mode (XArrays) to populate the grid from a recordset!
1. Start a form.
2. Put a grid on it.
3. Put a data control on it.
4. Set the Datasource property of the grid to the data control.
5. In code; (in the Form Load event)
Data1.Databasename="BIBLIO.MDB"
Data1.Recordsource="SELECT * FROM Authors"
Data1.Refresh
Run the program and grid is populated with the contents of the authors table.
If you want to specify the columns you want to display on the grid you can edit the grid at design time by right clicking on the grid and choosing EDIT. You can then add, delete and insert columns as you see fit. You then access the properties window of the grid, go to the Columns Tab and enter the appropriate DataField name for each column.
If you are using RDO, ADO etc it works in a similar way. Note that if you use ADO you need to use the OLEDB version of the grid.
If you still have problems send me an e-mail. [email protected]