By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,694 Members | 2,050 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,694 IT Pros & Developers. It's quick & easy.

Bind Text Box based on list box selection

P: n/a
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
Jul 21 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Are you using a Binding Context and Or a BindingManagerBase? That looks
like the problem... CHeck this out...
http://www.akadia.com/services/dotnet_databinding.html

HTH,

Bill
"Jeff" <jf***@marjoop.com> wrote in message
news:08****************************@phx.gbl...
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

Jul 21 '05 #2

P: n/a
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

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Jul 21 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.