Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Windows Forms / WinForm Data Binding / September 2006

Tip: Looking for answers? Try searching our database.

Binding ID column from helper table!!!

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Niyazi - 22 Sep 2006 13:19 GMT
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
Bart Mermuys - 22 Sep 2006 16:54 GMT
Hi,

> Hi,
> I am not sure if the correct format on my Subject line but I am having
[quoted text clipped - 31 lines]
> fills with Customername and Productname but when use the BindingNavigator
> save button I want to save their ID number.

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

> I guess I jump to erly to ADO.NET 2.0 so I couldn't find any example how
> to
[quoted text clipped - 11 lines]
> Rgds,
> GC
Niyazi - 23 Sep 2006 08:34 GMT
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.

>Hi,
>
[quoted text clipped - 26 lines]
>> Rgds,
>> GC
Niyazi - 26 Sep 2006 12:44 GMT
Hi Bart,

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

>Hi,
>
[quoted text clipped - 9 lines]
>>> Rgds,
>>> GC

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.