[英]Dynamic Select lists C#
I have three listboxes in windowsform app. 我在Windowsform应用程序中有三个列表框。 I want to display the countries, states, cities in respective three listboxes.
我想在相应的三个列表框中显示国家,州,城市。 But the states should be displayed according to the country selected and similarly for the cities.
但是,应根据所选国家/地区显示城市,并以类似的方式显示城市。
Now the code may not seem an issue for two three countries, but what if I take a practical situation keeping in mind all countries of the world and their corresponding states and cities. 现在,对于两个三个国家而言,该代码似乎不是问题,但是如果我考虑到现实世界的情况,同时牢记世界上所有国家及其相应州和城市的情况,该怎么办。
What will be the best way to implement this ? 实施此方法的最佳方法是什么?
Update --- I actually wanted to ask what data structures will be best for this ? 更新 ---我实际上想问一下哪种数据结构最适合呢?
A 3d jagged array wiil work fine .nO ? 一个3d锯齿状的数组可以正常工作。 or are there any better ways to do this ?
还是有更好的方法来做到这一点? i have no idea how to do this .
我不知道该怎么做。 Can anyone code this ?
任何人都可以编码吗?
load all the countries into the first list. 将所有国家/地区载入第一个列表。 when the user selects a country clear the state/providence and city list boxes.
当用户选择国家/地区时,请清除州/省和城市列表框。 load the cities for the select state/providence.
为所选州/省加载城市。 when a state/providence is selected load the cities.
选择州/省时,加载城市。
additional options: 附加选项:
Generally a top down hierarchy is applied. 通常,采用自上而下的层次结构。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.