if you want to just bind, set the recordsource of your form and your
controlsource on the control
OH, WAIT A SECOND, CSHARP DOES NOT KNOW ANYTHING ABOUT DATABASES
On Feb 14, 12:30 am, "RobinS" <Rob...@NoSpam.yah.none> wrote:
> "Patrick" <Patr...@home.com> wrote in message
>
> news:uhNokQ%(E-Mail Removed)...
>
>
>
>
>
> > I've been struggling with a while. Could someone please help me out?
> > I need to bind a property (wich is an custom object)
> > to a combobox that contains a list of the same objects.
>
> > ex:
> > class Manager()
> > {
> > public Employee EmployeeInfo
> > }
>
> > combobox contains a collection of Employee objects.
> > When navigating, I would like to autimatically display a field from the
> > corresponding Employee object from the combo that matches what is
> > assigned to the Manager. As well as be able to change the Managers
> > Employee object to what is selected in the combobox.
>
> > Everything works fine when I change the Employee object of the Manager to
> > say... EmployeeID (Which is a string).
>
> > Thanks a whole million!
> > --PAtrick
>
> Are you saying this: you are navigating through a list of Managers. Manager
> has a property called Employee. Somewhere else there is a list of
> Employees.
>
> You want to bind the combobox so it saves the EmployeeID in the Manager
> object, but shows the entries from the Employee list as options to be
> selected?
>
> You want to bind the combobox to the Employee list, then bind the
> SelectedValue to the EmployeeID in the Manager object.
>
> myComboBox.DataSource = EmployeeList
> myComboBox.DisplayMember = EmployeeList.EmployeeName
> myComboBox.ValueMember = EmployeeList.EmployeeID
> myComboBox.SelectedValue = ManagerList.EmployeeID
>
> Oh, and ignore that post from AaronKempf; he's trolling.
>
> Good luck, and if I didn't get the gist of your problem, please post again.
>
> Robin S.
> Ts'i mahnu uterna ot twan ot geifur hingts uto.- Hide quoted text -
>
> - Show quoted text -
|