Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C#
in windows forms i have two comboboxes first is for mobile manufacturer i.e nokia,samsung,sony and second combobox is for company's model like nokia pure view, samsung s3, htc one,
i want to change the model number as per the changes will happen to the first column, i means when user select nokia in the combobox1 then the combobox2 will show the company's model like nokia pure view, 6600,7610 etc etc from the next combobox, i dont want to save the model no. in the combobox's list i want to use the database connectivity with combobox so that i can update the new new upcoming model in the column then it will be easy so by reviewing i can bind the column with the combobox but how can i change the column when selection is change in combobox1
i prieously used the selection change event of the combobox with the strings saving all the models, but it is too hilarious that if i want to update the model i want to edit the whole software. so i decided it should be in a column so that i can update that but i dont know to logic how to change
sorry for my bad explanation i am weak in english
i have used this before
 if ("samsung" == comboBox1.SelectedItem.ToString())
            {
                comboBox2.Items.AddRange(samsung);
            }
            else if ("apple" == comboBox1.SelectedItem.ToString())
            {
                comboBox2.Items.AddRange(apple);
            }
Posted 30-Dec-12 2:28am
sariqkhan1.4K
Edited 30-Dec-12 5:51am
v3

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

Here is a detailed guide: Cascading DropDownLists with jQuery and ASP.NET[^]
 
I've written a bit about databinding here: Depends4Net - Part 2[^]
 
Best regards
Espen Harlinn
  Permalink  
v2
Comments
sariqkhan at 30-Dec-12 9:03am
   
i am using windows form
Espen Harlinn at 30-Dec-12 9:07am
   
Then the answer is even easier, just use a BindingSource to provide the elements - http://msdn.microsoft.com/en-us/library/system.windows.forms.bindingsource.aspx
 
Settng them up is similar to: http://msdn.microsoft.com/en-us/library/c12c1kx4.aspx
sariqkhan at 30-Dec-12 10:51am
   
can you tell me verbally the link i cant understand, i am a newbie
Espen Harlinn at 30-Dec-12 10:54am
   
Try reading up on Windows Forms Data Binding: http://msdn.microsoft.com/en-us/library/ef2xyb33.aspx

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



Advertise | Privacy | Mobile
Web02 | 2.8.141220.1 | Last Updated 30 Dec 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100