简体   繁体   English

选择组合框时的默认文本

[英]Default Text when choose Combo Box

I have two combo boxes, ComboBox Country and ComboBox City. 我有两个组合框,ComboBox Country和ComboBox City。 When I change value in ComboBox Country, ComboBox City will be filled with Cities from Country I choose in first combobox. 当我在“组合框国家”中更改值时,“组合框城市”将填充我在第一个组合框中选择的国家中的城市。 Is it possible every time i change ComboBox Country value, the combobox City show "Please Choose City"?. 每次更改组合框国家/地区值时,组合框城市显示“请选择城市”是否可能? Because in my current condition, ComboBox City will show the cities from country i choose (eg London, Manchester). 因为在当前情况下,ComboBox City会显示我选择的国家(例如伦敦,曼彻斯特)的城市。 Here is my current code to fill ComboBox City 这是我当前的代码来填充ComboBox City

  dtTable = SQLqueryGetListCities
  ComboBoxCity.DataSource = dtTable
dtTable = SQLqueryGetListCities

DataRow dr = dtTable.NewRow();
dr["CityID"] = "0";
dr["CityName"] = "Select City";
dtTable.Rows.InsertAt(dr, 0);
dtTable.AcceptChanges();

ComboBoxCity.DataSource = dtTable

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM