Here is the code to Bind DataGridView combobox cell with DataSource
First insert all items in a List of Strings and then Bind this string with DataGridView combobox cell
'grdBilling is a DataGridView
Dim List As New List(Of String)
strsql = "Select BatchNo from Purchase where Code = '" & grdBilling.Rows(e.RowIndex).Cells(0).Value & "'"
Dim objDataAdapter As New SqlClient.SqlDataAdapter(strsql, Conn)
objDataAdapter.Fill(ds)
If ds.Tables(0).Rows.Count > 0 Then
For item As Integer = 0 To ds.Tables(0).Rows.Count - 1
myList.Add(ds.Tables(0).Rows(item)(0).ToString())
Next
Else
End If
If ds.Tables(0).Rows.Count > 0 Then
'Cast DataGridView cell with DataGridView combobox cell and strDataSource
CType(grdBilling.Rows(e.RowIndex).Cells(2), DataGridViewComboBoxCell).DataSource = myList
End If