Relational Combobox C# BD Access

Asked

Viewed 138 times

1

I am building a C# application with Access database.

I have two tables one of CIDADE and another of ESTADOS.

What I need is when I am selected on combobox1 a state, the combobox2 load only cities corresponding to the state.

  • 1

    Hello @Hudson, welcome to [en.so]. What you’ve done so far. You can post an example of what you’ve tried to do?

  • Possible duplicate of http://answall.com/questions/10697/selectr-automaticamente-um-select-e-acionar-o-bot%C3%A3o or http://answall.com/questions/14646/como-selectr-uma-op%C3%A7%C3%A3o-em-um-select-e-carregar-data-related-in-another/14668#14668 or http://en.stackoverflow.com/questions/26291/popular-combo-com-chamada-de-ajax

  • is that I’m starting in C#, and so far I’ve done nothing...

1 answer

0


without you passing a piece of code gets a little complicated, but I will try to answer you so that you can understand with ease, come on...

Your combobox1 has an event that runs every time you select a value (I don’t know if you’re using Windows Forms or WPF so I can’t tell you the event name for sure). In this event you will schedule the routine that will load the cities in your second combobox (combobox2)

Here is a similar question, maybe it will help you: https://stackoverflow.com/questions/6850932/c-sharp-setting-up-data-bound-cascading-combo-boxes-at-design-time

You can also search for "Cascading combobox on c#" in Google, for sure you will find many examples and tutorials.

Hugs.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.