如何在vb.net中向gridview添加组合框?

时间:2017-04-30 06:45:55

标签: vb.net

我尝试在gridview中添加组合框但是我收到此错误:

  

异常:类型的值   'System.Windows.Forms.DataGridViewComboBoxColumn'无法转换   到'System.Web.UI.WebControls.DataControlField'。

这是我的代码:

Dim bsCountry As BindingSource

            Dim col As New DataGridViewComboBoxColumn
            col.DataPropertyName = "countryName"
            col.HeaderText = "Country"
            col.Name = "cName"

            col.DataSource = bsCountry
            col.DisplayMember = "countryName"
            col.ValueMember = "countryId"

            GridView2.Columns.Add(col)
            GridView2.DataBind()

0 个答案:

没有答案