PC Review


Reply
Thread Tools Rate Thread

Bind Text Box based on list box selection

 
 
Jeff
Guest
Posts: n/a
 
      24th Dec 2003
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


 
Reply With Quote
 
 
 
 
William Ryan
Guest
Posts: n/a
 
      24th Dec 2003
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" <(E-Mail Removed)> wrote in message
news:08c101c3ca45$3a60ea50$(E-Mail Removed)...
> 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
>
>



 
Reply With Quote
 
Jeff Frederick
Guest
Posts: n/a
 
      29th Dec 2003
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!
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Displaying a memo in a text box based on the selection in a list b =?Utf-8?B?TWFydW5v?= Microsoft Access Form Coding 3 12th Apr 2006 01:34 AM
Help : Bind control based on selection of others ???? =?Utf-8?B?c2VyZ2UgY2FsZGVyYXJh?= Microsoft ASP .NET 1 19th Jan 2006 05:11 PM
Re: How to populate text fields based on drop down list's selection Cor Microsoft ADO .NET 2 30th Mar 2004 09:44 AM
Re: How to populate text fields based on drop down list's selection Lucas Tam Microsoft ADO .NET 0 29th Mar 2004 05:37 PM
Text box based on list box selection HeatherM Microsoft Access Forms 3 7th Aug 2003 04:40 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 06:50 AM.