Bind Text Box based on list box selection

J

Jeff

Hello All:

What I am trying to do is bind a textbox (really several
text boxes) based on a list box selection. Basically what
I'm dealing with are two tables with a 1 to 1
relationship.

I have created the dataset and defined the relationship
between the two tables in the schema. I add a list box to
a form and set it's datasource to the parent table and its
displaymember to the value I want to display from the
parent table, in my case:

DataSource = dsData.WNTable
DisplayMember = WN

Where
a.) "dsData" is the name of the dataset
b.) "WN" is the name of a field in the WNTable

Because the relationship is 1 to 1 I don't need to use a
datagrid (I can get this to work with a datagrid but this
is not ideal b/c it only returns 1 row). I only need a
text box for each value I want to display, so in my case I
want to add 3 text boxes that are bound by the
parent/child relationship so when I select an item from
the list the relevant data appears in the text boxes. I
tried setting the Text property of each text box by using
the defined relationship, for example one of the text
boxes Text property is:

dsData - WNTable.WN_Act.DFS

where
a.) "dsData" is the datset
b.) "WN_Act" is the relationship name that defines the
relationship between the WNTable and the ActTable
c.) "DFS" is a field in the ActTable, this is the value I
want to display in the text box.

When I run the program the list box and the text boxes are
not "related" at all. Is there a way to do this or do I
have to use a datagrid even though it would only contain 1
row of information? I set all of the properties,
relationships, etc. at design time (not with code). I
don't think this should matter but maybe it does. Please
Help!!

Many Thanks in Advance,

Jeff
 
J

Jeff Frederick

William:

Thank's for the pointer. I figured out what was wrong, I was setting
the data source incorrectly for the list box so there were two different
currency managers. Thanks for you help.

Jeff
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top