【问题标题】:Choosing a Custom default combo box value in VB.NET在 VB.NET 中选择自定义默认组合框值
【发布时间】:2010-04-15 15:22:51
【问题描述】:

我有一个组合框,其中填充了来自数据源的值。默认情况下,选择第一个值很好,但我需要显示“选择国家”作为默认组合框文本。然后用户可以从下拉列表中进行选择。

The reason is when the first value from datasource is chosen as the default value the rest of the form field are automatically filled(implemented in selectindexchange method) but I need the form to be empty on load and diplay "Choose country" as组合框文本。

怎么做?

我的组合框已填满

CountryDetailsBindingSource.DataSource = CountryCtrl.GetCountryDetails(Id)//this returns an array
 Me.SelectCountry.DataSource = Me.CountryListBindingSource
 Me.SelectCountry.DisplayMember = "CountryName"
 Me.SelectCountry.ValueMember = "ID"

感谢任何帮助。

提前致谢

【问题讨论】:

    标签: vb.net combobox


    【解决方案1】:

    我认为如果您在数组的开头插入一个新值,并为其指定 CountryName“Choose Country”和 ID -1,它可能会起作用。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2012-05-01
      • 1970-01-01
      • 2019-11-05
      • 1970-01-01
      • 2011-04-28
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多