The following code will work on a Form ComboBox:
I'm trying to implement the same method on a DataGridView Combobox cell, but i'm not sure how to reference the cell:Code:ComboBox1.SelectedIndex = ComboBox1.FindStringExact("YourStringyouknow")
I tried:Code:For Each row As DataGridViewRow In DataGridView1.Rows DGVCombobox.SelectedIndex = DGVCombobox.FindStringExact("YourStringyouknow") 'obviously this doesn't work Next
Code:For Each row As DataGridViewRow In DataGridView1.Rows Dim DGVCmbBx As DataGridViewComboBoxCell = TryCast(row.Cells("POItems"), DataGridViewComboBoxCell) DGVCmbBx.Selected = DGVCmbBx.Items("YourStringyouknow") 'but this is expecting an integer, not a string Next




Reply With Quote
