Hopefully I'm just making a mistake somewhere. Here is my setup. I have a truegrid control with 2 columns (username
and last name) and I have 3 textboxes for username, last name and first
name.
First, in code, I databind a datatable to the truegrid using the datasource property.
Next I databind the same datatable to the textboxes.
The form loads and when I select a row (or cell of a row) in the
truegrid the texboxes update and change to show the bound columns of
the newly selected row. i.e. I click fSlacker and Fred Slacker shows up
in the textboxes below.
However, the design time columns are ignored and the entire table I'm loading shows up in the grid.
So, I replace the first step in my code with: TrueGridInstance.SetDataBinding(DataSetInstance, "tablename", true)
And recompile the project.
The form loads and the truegrid looks correct (only two columns show) and fills with data. But,
when I select a row ( or cell of a row ) the textboxes do Not update
and change to show the bound columns of the newly selected row. i.e, I
click fSlacker and Joan Arc (first entry in the datatable) always
displays in the textboxes.
So, to recap, if I use the truegrid's DataSource property the other bound controls behave "correctly" but if I use SetDataBinding, they don't. Is there a bug or am I using the SetDataBinding incorrectly or is
SetDataBinding just Not meant to work in this way? I really wanted to
use the TrueGrid for it's filter row features but I don't want to
re-write how our data schema is done just for that.
Any help would be greatly appreciated and I hope I'm just doing something wrong.
Here's the code that doesn't work:
With usr.Dataset_UserGroupMgr
C1TrueDBGrid1.SetDataBinding(usr.Dataset_UserGroupMgr.Tables("UserList"), "UserList", True)
txtUserName.DataBindings.Add("text", .Tables("UserList"), "sUserName")
txtFirstName.DataBindings.Add("text", .Tables("UserList"), "sFirst")
txtLastName.DataBindings.Add("text", .Tables("UserList"), "sLast")
End With
Heres the code that does :
With usr.Dataset_UserGroupMgr
C1TrueDBGrid1.DataSource = .Tables("UserList")
txtUserName.DataBindings.Add("text", .Tables("UserList"), "sUserName")
txtFirstName.DataBindings.Add("text", .Tables("UserList"), "sFirst")
txtLastName.DataBindings.Add("text", .Tables("UserList"), "sLast")
End With