How can one ComboBox's items be determined by another?

Good day everyone, I don't have any code as yet to support my question, as I'm at this stage merely searching for direction.
I'm trying to figure out if / how can one ComboBox's items be determined by another, but without creating a Class to do the filter... most of the Threads and reading I've done thus far points in this direction ( that you do need it)
I've however been challenged to do it with out....does anyone know if this is a possibility?

thanks
Fadiel
fadiel rasAsked:
Who is Participating?

Improve company productivity with a Business Account.Sign Up

x
 
Pawan KumarConnect With a Mentor Database ExpertCommented:
If you need cascading effect use below-

1. You have to fill the parent combo box. and based on the default value to parent combo box fill the child combo box.
2. Now when the end user changes the value of the parent combo box , fill the child combo box again.

You can use below URL for the entire steps. <<This url uses the example of Country and states>>
http://csharpdotnetfreak.blogspot.com/2012/07/cascading-combobox-in-winforms-windows-forms.html

Hope it helps!!
0
 
Pawan KumarDatabase ExpertCommented:
Are you talking about cascading parameters ?

E.g. State and Country , Based on country we shall fill States ?
0
 
Scott McDaniel (Microsoft Access MVP - EE MVE )Connect With a Mentor Infotrakker SoftwareCommented:
I use the SelectedIndexChange event of the combo to fill the dependent combo. For example, if I have a combo where the user selects a Car Make (cbMake), and I want to fill a combo where they can select the Car Model (cbModel), I'd do something like this in the SelectedIndexChange event of cbMake:

Using con As New SQLConnection(ConnectionString)
  con.Open
  Using cmd As New SQLCommand
    cmd.Connection = con
    cmd.CommandText = "SELECT ID, Model FROM tModels WHERE MakeID=" & cbMake.SelectedValue
    Dim dt As New Datatable
    dt.Load (cmd.ExecuteReader)
    With cbMake
      .DataSource = dt
      .DisplayMember = "Model"
      .ValueMember = "ID"
    End With
  End Using
End Using

Open in new window

0
Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

 
fadiel rasAuthor Commented:
thanks Gents, I'll give your suggestion a try asap this morning!

>>Are you talking about cascading parameters ?
>>E.g. State and Country , Based on country we shall fill States ?

yes, 100% correct I was referring to cascading parameters

I'll feedback to the forum - thank you
0
 
Pawan KumarDatabase ExpertCommented:
Great ! Welcome.

Good luck !
0
 
fadiel rasAuthor Commented:
Hi there,
if my requirement changed to the Dropdown being within a data grid view and NOT a ComboBox do I post a new question?
or could the ComboBox solutions still work / be amended?

thank you
0
 
Pawan KumarDatabase ExpertCommented:
Yes that's a completely new question. I think you should post a new question for that.

Thank you!

Regards,
Pawan
0
 
fadiel rasAuthor Commented:
Thanks Pawan, Scott and Eric
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.