Problems with DataGridViewComboBox

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • tim8w via DotNetMonster.com

    #1

    Problems with DataGridViewComboBox

    I am using a DataGridViewCom boBox in a DataGridView. When a user selects a
    radio button, I would like to clear all the items in the DataGridViewCom boBox
    and repopulate with new values. I do this as follows:

    Code:
            Dim iIndex As Integer
    Dim dgcb As DataGridViewComboBoxCell
    
    For iIndex = 0 To dgvRecipe.RowCount - 1
    
    dgcb = dgvRecipe.Rows(iIndex).Cells("Measure")
    dgcb.Items.Clear()
    If radEnglish.Checked Then
    dgcb.Items.AddRange(New String() {"t", "T", "Cup", "Quart",
    "Gallon", "oz", "lbs"})
    Else
    dgcb.Items.AddRange(New String() {"mg", "g", "ml", "Litre"})
    End If
    Next iIndex
    It appears to do the job, but later while the control is refreshing i get the
    error:

    [COLOR="Red"]The following exception occured in the DataGridView:

    System.Arguemen tException: DataGridViewCom boBoxCell value is not valid.

    To replace this default dialog please handle the DataError event.[/COLOR]

    Any ideas?

    --
    Message posted via DotNetMonster.c om
    Best online pokies for real money in Australia and learn about safety and game mechanics in this comprehensive guide.


  • tim8w via DotNetMonster.com

    #2
    Re: Problems with DataGridViewCom boBox

    Just needed to either clear or set to a new value any items that were set to
    the old ComboBox items...

    --
    Message posted via http://www.dotnetmonster.com

    Comment

    Working...