2 Bounds DataGridViewComboBoxColumn - Select value from the first should filter the second !

Hi All,

I saw that a some members ask the same question and no one get an answare until now.

I have a simple situation , One column is bounded to the "countries" table (country,description) , and the ather is bounded to the "cities" table (country,city,description).

All I want is : when the user will select a country from the first column he will see

just the relevant cities in the second column.

The problem become when eatch row have different country .

Please send me a code sample.

Best Regards

Boaz Shalev.



Answer this question

2 Bounds DataGridViewComboBoxColumn - Select value from the first should filter the second !

  • SimonDa

    Thanks Mark,

    It's work , I have one more problem.

    I'm getting an Error Dialog Because I'm using this code:

    subCategoryComboBoxColumn.DataPropertyName = "city" (I need to display the existent values)

    The error message id "DataGridViewComboBoxCell Value Is Not Vaild".

    How Can I solve this problem.

    Thank Again

    Boaz Shalev.


  • ErikHedlund

    Yes,

    I will help you , Please send the code .

    Boaz Shalev.


  • blindlizard

    This means that somewhere you have a city value that does not exist in your City table. You need to ensure that all values for City are in the table.

    -mark
    DataGridView Program Manager
    Microsoft
    This post is provided "as-is"


  • Awaneesh

    Hello Boaz Shalev

    It seems your problem is solved. I have a similar problem, but the DataGridView FAQ has not been useful because its is C#.

    Can you pl guide me on this , esp the begin edit and end Edit commands. I believe thats the place my code is going wrong.

    thanks.


  • Anfernee

    Check out this post: http://forums.microsoft.com/MSDN/ShowPost.aspx PostID=314900&SiteID=1

    -mark
    DataGridView Program Manager
    Microsoft
    This post is provided "as-is"


  • mofo

    Thanks Mark,

    I will check it .

    Regards

    Boaz Shalev.


  • 2 Bounds DataGridViewComboBoxColumn - Select value from the first should filter the second !