How to add multiple columns in DataGridViewComboBoxColumn?

  • Thread starter Thread starter xboxown
  • Start date Start date
X

xboxown

Guest
Private Sub ComboBox_SelectionChangeCommitted(ByVal sender As System.Object, ByVal e As System.EventArgs)
Dim combo As ComboBox = CType(sender, ComboBox)
Dim cmb As New DataGridViewComboBoxColumn()
cmb.HeaderText = "Item"
cmb.Name = "cmbItems"

Select Case combo.SelectedIndex
Case 0
Call MsgBox("Stock")
lngSelectSource = combo.SelectedIndex
FillDropDownList(cmb, "SELECT StockID, BffGrade AS Grade, [Description], BoardFeet, Unit, Price, -1, Height, Width, Length, Height*Width*Length/144, 0 FROM tblStock WHERE tblStock.IsActive <>0 ORDER BY BffGrade")

dgvWorkOrdersItems.Columns.Add(cmb)
Exit Sub
Case 1
Call MsgBox("Stock (Customer $)")
lngSelectSource = combo.SelectedIndex
Exit Sub
Case 2
Call MsgBox("Product")
lngSelectSource = combo.SelectedIndex
Exit Sub
Case 3
Call MsgBox("Product (Customer $)")
lngSelectSource = combo.SelectedIndex
Exit Sub
Case 4
Call MsgBox("Custom Products")
lngSelectSource = combo.SelectedIndex
Exit Sub
End Select


Console.WriteLine("Row: {0}, Value: {1}", dgvWorkOrdersItems.CurrentCell.RowIndex, combo.SelectedItem)



End Sub

This is the code above!

What I want to do is in the datagridview combobox I want when the user click on the combolist it have three columns inside the comboxbox:

BFFGrade Description ProductID

22222 Item 1 1

2004T Item 2 2

7070 Item 3 3

HI20 Item 4 4

LOA1 Item 5 5

7672 Item 6 6


When the user select Item 4 I store in the variable I declared Dim lngProductID as long with value 4!


Any new idea how do I go about doing that?!

Continue reading...
 

Similar threads

Back
Top