开发者

How to add a items in the dropdownlist

开发者 https://www.devze.com 2022-12-12 10:50 出处:网络
Using VB.NET I want to add a data\'s in the Datagridviewcombobox column Code. cmd = New SqlCommand(\"SELECT Sched_Name from tb_Sched_Master\", con)

Using VB.NET

I want to add a data's in the Datagridviewcombobox column

Code.

cmd = New SqlCommand("SELECT Sched_Name from tb_Sched_Master", con)
    ada = New SqlDataAdapter(cmd)
    ada.Fill(ds1)
    x.HeaderText = "Select Employee"
    DataGrid4.Columns.Add(x)
    x开发者_如何转开发.Items.Add(ds1.Tables(0))

But I cannot get the data's, what wrong in my code.

Need vb.net code Help


Try to set datasource property of your DataGridViewComboBoxColumn :

// Column that will be used to set the value of the items in your combobox : 
yourColumn.ValueMember = "YourValueField"

// Column that will be displayed for items in your combobox : 
yourColumn.DisplayMember = "YourTextField"

yourColumn.DataSource = ds1.Tables(0)
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号