Quantcast
Channel: Windows Forms Data Controls and Databinding forum
Viewing all articles
Browse latest Browse all 2535

reading the value of id in another table and set it as Display Member of combobox. without coding is it possible ?

$
0
0

Hi Experts, before i tell the problem firstly i'd like to show these 3 table.

Country

country_code | country_name

1                        USA

2                        SPA

Person

person_id  |  person_name

AA                      Andy

BB                      Oliver

Country-Person

Id   |   Person_id   |  Country_id

01       AA                  1                  

02       AA                  2

03       BB                  1

in VB2010, i created 2 comboboxes :

1) cbx_country, country_name as the DISPLAY MEMBER

                       country_id       as the VALUE MEMBER

2)cbx_person, (?) as the DISPLAY MEMBER

                         (?) as the VALUE MEMBER

And Here is the scenario :

1) first, i choose the country by using the cbx_country, say : 1 (USA)

2) then, in the cbx_person, i want to set this combobox to display theperson_name where country_id = 1 (means that : display the name of the person who has house in USA for example) and put the result of it into cbx_person as the DISPLAY MEMBER, and i want theDISPLAY VALUE is id field of country_persontable.

i thought that this is the appropriate algorithm to set the cbx_person is something like this :

1) creating query (say : QUERY1) by JOINning the country_person andperson table by using the key of country_person.person_id = person.person_id(right ?)

2) then SELECT the person_name FROM QUERY1 WHERE country_id = cbx_country.selectedvalue

3) then display the result of those query as the DISPLAY MEMBER of cbx_person.

I know this is the appropriate algorithm, but i find the difficulties to implement it into VB2010.

if possible, is there any way to solve this without writting any code ?(i hope YES).

may be just use the combobox tasks tool ?

thanks in advance




Viewing all articles
Browse latest Browse all 2535

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>