Click here to Skip to main content
15,893,668 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more:
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
Updated 30-Dec-12 4:51am
v3

1 solution

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
 
Share this answer
 
v2
Comments
sariqkhan 30-Dec-12 9:03am    
i am using windows form
Espen Harlinn 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 30-Dec-12 10:51am    
can you tell me verbally the link i cant understand, i am a newbie
Espen Harlinn 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)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900