2 comboboxes

  • Thread starter Thread starter freddy
  • Start date Start date
F

freddy

I want to select text from combobox 1 and have another combox with a list of
different items. Example:

if cb1 is Dell than show me only the laptop for dell on cb2
if cb1 is IBM than show me only the laptop for IBM on cb2
 
I want to select text from combobox 1 and have another combox with a listof
different items. Example:

if cb1 is Dell than show me only the laptop for dell on cb2
if cb1 is IBM than show me only the laptop for IBM on cb2

and your question is?

simply handle the selectedIndexChange in cb1 and then repopulate cb2
 
What do you mean?

This?

cb2.Items.Clear();
if (cb1.Text == "Dell")
{
cb2.Items.Add("Dell option 1");
cb2.Items.Add("Dell option 2");
cb2.Items.Add("Dell option 3");
} else if (cb1.Text == "IBM")
{
cb2.Items.Add("IBM option 1");
cb2.Items.Add("IBM option 2");
cb2.Items.Add("IBM option 3");
}
 
What do you mean?

This?

cb2.Items.Clear();
if (cb1.Text == "Dell")
{
  cb2.Items.Add("Dell option 1");
  cb2.Items.Add("Dell option 2");
  cb2.Items.Add("Dell option 3");} else if (cb1.Text == "IBM")

{
  cb2.Items.Add("IBM option 1");
  cb2.Items.Add("IBM option 2");
  cb2.Items.Add("IBM option 3");



}



- Show quoted text -

That is in the most primitive form yes. If you have them in a table or
a dataset you can do it in a general way.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Back
Top