tags:

views:

46

answers:

1

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

A: 

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)
Canavar
What do you mean by your value field and Text Filed, Can you please.
Gopal