Categories: MSDN / DotNet / Java / Scripts / Linux / PHP Ask - La ask - La Answer

Textboxes wont update from Child Tables

I have a VB.Net Windows app which does a WMI query, and populates a dataset which I create at run time from a (relational tables) schema.
The dataset gets populated OK.
dataset ("tblAdapters") has 5 tables:

Table: Configurations
Fields:
MACAddress
Index
Description (Key)
DNSDomain
DNSHostname
PrimaryWINS
SecondaryWINS
ConfigType

Table: IPAddr
Fields:
AdapterDesc (Key)
Index
IPAddress

Table: SubnetAddr
Fields:
AdapterDesc (Key)
Index
IPAddress

Table: GatewayAddr
Fields:
AdapterDesc (Key)
Index
IPAddress

Table: DNSAddr
Fields:
AdapterDesc (Key)
Index
IPAddress

The relations are:
"ConfigsDNSAddress", "ConfigsIPAddr", "ConfigsGatewayAddr", and "ConfigsSubnetAddr" All relations link Configurations.Description to Subtable.AdapterDesc.

I force the DNSAddr subtable to have 3 rows, even if IPAddresses are "".

Configurations.Description displays in a combobox ("cboAdapters"). All the other data fields are in textboxes.

In form_load:

WithMe.cboAdapter
.DataSource = tblAdapters.Configuration
.DisplayMember = "Description"
EndWith
WithMe
.txtMAC.DataBindings.Add(New Binding("Text", tblAdapters.Configuration, "MACAddress"))
.txtDHCP.DataBindings.Add(New Binding("Text", tblAdapters.Configuration, "ConfigType"))
.txtWINS1.DataBindings.Add(New Binding("Text", tblAdapters.Configuration, "PrimaryWINS"))
.txtWINS2.DataBindings.Add(New Binding("Text", tblAdapters.Configuration, "SecondaryWINS"))
.txtDNSDomain.DataBindings.Add(New Binding("Text", tblAdapters.Configuration, "DNSDomain"))
.txtIPAddr.DataBindings.Add(New Binding("Text", tblAdapters.Relations("ConfigsIPAddress").ChildTable.Select("Index = 0"),"IPAddress"))
.txtSubnet.DataBindings.Add(New Binding("Text", tblAdapters.Relations("ConfigsSubnetAddress").ChildTable.Select("Index = 0"), "IPAddress"))
.txtDefGW.DataBindings.Add(New Binding("Text", tblAdapters.Relations("ConfigsGatewayAddress").ChildTable.Select("Index = 0"), "IPAddress"))
.txtDNS1.DataBindings.Add(New Binding("Text", tblAdapters.Relations("ConfigsDNSAddress").ChildTable.Select("Index = 0"), "IPAddress"))
.txtDNS2.DataBindings.Add(New Binding("Text", tblAdapters.Relations("ConfigsDNSAddress").ChildTable.Select("Index = 1"), "IPAddress"))
.txtDNS3.DataBindings.Add(New Binding("Text", tblAdapters.Relations("ConfigsDNSAddress").ChildTable.Select("Index = 2"), "IPAddress"))
EndWith

Here's the problem:

When the form loads, the combobox and all the textboxes are filled with correct data from the dataset.

However, when the combobox selection is changed, all the textboxes which have bindings that do not reference a relation change correctly. The ones which use the format "tblAdapters.Relations("RelationName").ChildTable.Select("Index = 0")" do not.

How can I fix this?

Thanks
Rob
[3354 byte] By [robnjay] at [2007-11-11 7:32:44]
# 1 Re: Textboxes wont update from Child Tables
I submitted this question in December, no answers...

The issue is, when I bind a textbox to the child table in a relation using a lookup ("Index = 0" - Index is a field in the child table). There is a combobox bound to the parent table on the form. The form has several textboxes bound to the parent table, and a few bound to various child tables in the relational schema using relationships defined in the schema

1. The data is retrieved to all the textboxes on form load.

2. As you select different rows in the parent table using the combo box, all the textboxes on the same form which are bound to rows in the parent table get different data (they update) - the textboxes bound to the child tables do not.

3. As a diagnostic, I stuck a grid on the form. As you use the combo box (or the grid) to select a different row in the parent table, all the controls on the form update except the textboxes which are bound to child tables. Also, you can see the data in the child tables in the grid, but the standard layout is not good (which is why I wanted to pull a single item out of a child table to a textbox).

I believe this probably should work - is there any way to get someone with knowledge of the inner workings of .Net to look at this? Or is the only way you can get such information require a payment to Microsoft for "technical support"?
robnjay at 2007-11-11 21:48:56 >