Results 1 to 11 of 11

Thread: [RESOLVED] DataGridView ComboBox - SelectedIndex to FindStringExact

Threaded View

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Jul 2013
    Posts
    178

    Resolved [RESOLVED] DataGridView ComboBox - SelectedIndex to FindStringExact

    The following code will work on a Form ComboBox:

    Code:
    ComboBox1.SelectedIndex = ComboBox1.FindStringExact("YourStringyouknow")
    I'm trying to implement the same method on a DataGridView Combobox cell, but i'm not sure how to reference the cell:

    Code:
    For Each row As DataGridViewRow In DataGridView1.Rows
        DGVCombobox.SelectedIndex = DGVCombobox.FindStringExact("YourStringyouknow") 'obviously this doesn't work
    Next
    I tried:
    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
    Last edited by Fedaykin; Jul 6th, 2018 at 05:51 PM.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width