all groups > dotnet windows forms databinding > september 2006 >
You're in the

dotnet windows forms databinding

group:

Binding ID column from helper table!!!


Binding ID column from helper table!!! Niyazi
9/22/2006 12:19:36 PM
dotnet windows forms databinding:
Hi,
I am not sure if the correct format on my Subject line but I am having
problem that I find very difficult sleep last 2 days.

I have a CustomerTable, ProductTable and OrderTable in my SQL Server 2000.

I create and Order Form that I can enter new order or search order by Product,
Customer and Price.
The CustomerTable and ProductTable Forms works fine. In the OrderTable form
is about 600 x 600

And the first 300 from above i place the DataSource details controls and the
bottom of the form I place the Datagrid.

The searching the ordertables was great but I am having problem inserting the
new order.
In the CustomerID and ProductID textBoxes I convert to them as ComboBoxes. So
that I don't want to see the ID numbers but I wanted to see the CustomerName
and Productname.

This part I couldn't make it to work to show the in 2 comboboxes the
respectivly:

Not CustomerId -----> but CustomerName
Not ProductId --------> but Productname.

I also want to use Bindingnavihator Add button so in the both comboboxes
fills with Customername and Productname but when use the BindingNavigator
save button I want to save their ID number.


I guess I jump to erly to ADO.NET 2.0 so I couldn't find any example how to
achive this in VB.NET 2005

So, does anyone have any good example how to solve this problem? Or I also
like to see any good article that demonstrates how to achive this problem in
a easy way. I thought jumping the ADO.NET 2.0 was reduce my coding time that
I had previously speend many hours to achive it withj early ADO.NET.

I thank you for reading mu post.

Rgds,
GC
Re: Binding ID column from helper table!!! Bart Mermuys
9/22/2006 3:54:19 PM
Hi,

[quoted text, click to view]

CustomerComboBox.DataSource = CustomersBindingSource
CustomerComboBox.DisplayMember = "CustomerName"
CustomerComboBox.ValueMember = "Id" ' PK
CustomerComboBox.DataBindings.Add("SelectedValue", OrderBindingSource,
"CustomerId") ' FK

You don't need any other bindings for the ComboBox (eg. don't bind Text),
you can set this up using the designer too. If you aren't using any
BindingSource's then replace with the DataTable's or DataViews you're
using.

Also see:
http://msdn2.microsoft.com/en-us/library/3h6ac01k.aspx

HTH,
Greetings

[quoted text, click to view]

Re: Binding ID column from helper table!!! Niyazi via DotNetMonster.com
9/23/2006 12:00:00 AM
Hi,

Thnak you very much. I try it before and it seems I get confuse about how to
bind the combobox using designer. I will try it one more time today and acept
this is the answer.

Thank you.



[quoted text, click to view]

--
Message posted via DotNetMonster.com
http://www.dotnetmonster.com/Uwe/Forums.aspx/winform-data-binding/200609/1
Re: Binding ID column from helper table!!! Niyazi via DotNetMonster.com
9/26/2006 11:45:01 AM
Hi Bart,

It was perfect. Thank you very much for helping me out.

[quoted text, click to view]

--
Message posted via DotNetMonster.com
http://www.dotnetmonster.com/Uwe/Forums.aspx/winform-data-binding/200609/1
AddThis Social Bookmark Button