So now I am building a form and have my Data-Set bound to it.
This kind of binding seems to work fine for a browser.
I need to attach Data-fields from a child table to an editor and that does not seem to be possible. I am only allowed to bind a field from the parent table.
Do I in this case have to work with individual temp-tables instead of dataset?
So now I am building a form and have my Data-Set
bound to it.
This kind of binding seems to work fine for a
browser.
I need to attach Data-fields from a child table to an
editor and that does not seem to be possible. I am
only allowed to bind a field from the parent table.
Do I in this case have to work with individual
temp-tables instead of dataset?
You can bind to child tables using the DataMember property.
If you have a PDS of Customer - Order - OrderLine - Item, you can bind to fields in the Item table by setting the DataSource to the binding source, and then the DataMember might be 'Order.OrderLine.Item.ItemDesc'.
-- peter
I had the same question. I understand what you mean but I don't see DataSource or DataMember properties. Will this work for a System.Windows.Forms.TextBox?
I'm sorry but I'm still unclear on the method for this. Could you please elaborate.
I'm sorry but I'm still unclear on the method for
this. Could you please elaborate.
It looks like the tools don't provide the ability to specify the DataMember in all cases. I tried with an UltraTextEditor and was only able to specify the top-level table.
However, you do this in code. Assuming a PDS with a structure like this:
ePurchaseOrder
-- ePOLine
eItem
You can then manually add the data bindings like such, and voila!
ultraTextEditor2:DataBindings:Add(
'Text',
bindingSource1,
'ePOLine.eItem.ItemName').
-- peter
That helps a lot thank you.
I am getting System.ArgumentException: DataMember property 'my-table' cannot be found on the DataSource. Perhaps I'm try to bind at the wrong time. Either way, thanks a lot for your help.
I am getting System.ArgumentException: DataMember
property 'my-table' cannot be found on the
DataSource. Perhaps I'm try to bind at the wrong
time. Either way, thanks a lot for your help.
I should note that you need to put that line of code after the call to InitializeComponent() in the constructor.
-- peter
Well, oddly I'm still getting the error. I must have something else wrong. I'll find it. I don't want to take up any more of your time.
I appreciate the help, thanks.
Ok, sorry, but I do have another question.
Do I need to add to the DataSource or DataMember properties for the BindingSource? I put that line of code in the constructor like:
InitializeComponent().
bindingSource1:Handle = dataset dsMyDataset:handle.
txtMyTextBox:DataBindings:Add("Text", bindingSource1, "my-table.child-table.description").
I get the error on the first table in the datamember parameter. The dash in the table name couldn't be a problem could it?
Do I need to add to the DataSource or DataMember
properties for the BindingSource? I put that line of
code in the constructor like:
InitializeComponent().
bindingSource1:Handle = dataset dsMyDataset:handle.
txtMyTextBox:DataBindings:Add("Text", bindingSource1,
"my-table.child-table.description").
I'd add the databinding before assigning the bindingSource Handle (although I suspect it doesn't make a difference).
I get the error on the first table in the datamember
parameter. The dash in the table name couldn't be a
problem could it?
The dash shouldn't be a problem by itself. The problem might be that you're adding the top table at all - the reference should be relative to the top. So, in your case, you just need "child-table.fieldname".
-- peter
Wow, ok...I just read your sample wrong. I somehow thought that you had started with the parent table.
Thanks for being patient.