Home Forums WinForms controls Other WinForms controls Combobox clear – returns error

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • User (Old forums)
    Member
    Post count: 23064
    #18226 |

    Hi Xceed

    I build a UserControl and have placed a winCombobox control on that usercontrol. I construct the winCombobox to have 4 columns (first cols width = 0, so that it don’t display).
    I fetch data in a datatable that i loop thourgh a add each item like;
    object obj1 = Convert.ToInt32(row[0]);
    object obj2 = row[1].ToString();
    object obj3 = row[2].ToString();
    object obj4 = row[3].ToString();
    Xceed.Editors.ComboBoxItem objItem = new Xceed.Editors.ComboBoxItem(new object[] { obj1, obj2, obj3, obj4 });
    winComboBox1.Items.Add(objItem);

    just before this looping i want to clear all existing items;
    winComboBox1.Items.Clear();
    This result i the error: {“Object reference not set to an instance of an object.”}

    Now i can put the winComboBox1.Items.Clear() within a try,catch, but should that me nessary?

    Kind regards
    Cheef Software Engineer
    Johnny E Jensen

    Imported from legacy forums. Posted by Johnny (had 2339 views)

    User (Old forums)
    Member
    Post count: 23064

    This should work fine. What version of the grid are you using (X.X.XXXX.X)? If you’re not using the latest version (3.2.6557.0), I suggest you upgrade to see if this resolve the issue.

    Imported from legacy forums. Posted by André (had 3210 views)

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.