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

txtbox.DataBindings with foreign table's attribute

$
0
0

Sorry my question may be a bit hard to understand.

I have a listbox that displays Vacancy.Description

lstBoxVacancy.DataSource = DM.lookingGlassDS;                                               
lstBoxVacancy.DisplayMember = "Vacancy.Description";                                        
lstBoxVacancy.ValueMember = "Vacancy.Description"; 



When you click on one of the items in the listbox, the text boxes on the side correlate to the selected description row(Vacancy.Description).



txtVacancyID.DataBindings.Add("Text", DM.lookingGlassDS, "Vacancy.VacancyID");   

txtDescription.DataBindings.Add("Text", DM.lookingGlassDS, "Vacancy.Description"); 

txtStatus.DataBindings.Add("Text", DM.lookingGlassDS, "Vacancy.Status");  

txtSalary.DataBindings.Add("Text", DM.lookingGlassDS, "Vacancy.Salary"); 

txtVacancyEmployerID.DataBindings.Add("Text", DM.lookingGlassDS, "Vacancy.EmployerID");

txtVacancyEmployerName.DataBindings.Add("Text", DM.lookingGlassDS, "Employer.EmployerName");


However, for the EmployerName value, the "Employer Name:" textbox is not changing when you select a new item in the listbox. I think this is because EmployerName comes from the Employer table and not the Vacancy table like the rest of the DataBindings.

txtVacancyEmployerName.DataBindings.Add("Text", DM.lookingGlassDS, "Employer.EmployerName");

My question is how do I make it so that when I click on a listbox item (Vacancy.Description), the associated EmployerName(Employer.EmployerName) is displayed in the EmployerName textbox?

In my DataSet, it says the relation name is EMPLOYERVACANCY between the Employer and Vacancy table. Parent table: EMPLOYER. Child table: VACANCY Primary key: EmployerID, Forgein key:EmployerID

Thank you very much



Viewing all articles
Browse latest Browse all 2535

Trending Articles



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