General information
Category:
The Mere Mortals .NET Framework
Mr. McNeish,
When I applid as you describe, synchronization problem occured. Both combobox shows the same city.
When I do as follow, problem solved.
1. HeadOfficeCity combo box:
BindingSource: Cities
BindingSourceDisplayMember: city_name
BindingSourceValueMember: city_id
BindingValueSource: Customer
BindingValueSourceMember: HeadOfficeCity_id
2. ShipCity combo box:
BindingSource: Cities
BindingSourceDisplayMember: Cities.DefaultView.city_name
BindingSourceValueMember: city_id
BindingValueSource: Customer
BindingValueSourceMember: ShipCity_id
Note: I haven't add any code to my Cities business object.
If I were need one more Combobox, I think I should use mmDataSet and add one DataView in my Cities business object, and I will use that DataView as BindingSourceDisplayMember. Is it true?
>Ali,
>
>>I have a Cities business object build on cities table which has two fields: city_id and city_name.
>>
>>I have a Customer table which has HeadOfficeCity_id and ShipCity_id fields.
>>
>>Using Cities business object as two different combo boxes, How can I control the HeadOfficeCity_id and ShipCity_id fields on the same form?
>
>You can use a single instance of the Cities business object as the binding source to fill the two combo boxes, specifying the display member and value member. You can then bind the comboboxes selected value to the Customer business object, specifying the two different value members. For example:
>
>1. HeadOfficeCity combo box:
>
>BindingSource: Cities
>BindingSourceDisplayMember: city_name
>BindingSourceValueMember: city_id
>
>BindingValueSource: Customer
>BindingValueSourceMember: HeadOfficeCity_id
>
>2. ShipCity combo box:
>
>BindingSource: Cities
>BindingSourceDisplayMember: city_name
>BindingSourceValueMember: city_id
>
>BindingValueSource: Customer
>BindingValueSourceMember: ShipCity_id
>
>Regards,
Previous
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only