1

i have an issue with the UI update of a DataGridView with a DataGridViewComboBoxColumn. When I set the value of a DataGridViewComboBoxColumnCell it works but the UI isn't refreshed.

I tried Invalidate(), Refresh() on the control. Giving it focus and afterwards switch the focus to another control. It is working when I use the same loop in an button event.

My code so far:

        BindingList<String> list = new BindingList<String>();
        list.Add("Value1");
        list.Add("Value2");

        DataTable table = new DataTable();
        DataColumn col = table.Columns.Add();
        col.ColumnName = "Key";
        col.DataType = typeof(String);

        dataGridView1.DataSource = table;
        table.Rows.Add("Key1");
        table.Rows.Add("Key2");

        DataGridViewComboBoxColumn combo = new DataGridViewComboBoxColumn();
        combo.DataSource = list;
        combo.Name = "Value";
        dataGridView1.Columns.Add(combo);

        foreach (DataGridViewRow row in dataGridView1.Rows)
        {
            row.Cells["Value"].Value = "Value1";
        }

I had similar behaviour with two ZedGraphControls. I implemented dependant zoom and the scale only changed in the plot when I first zoomed manually in both controls. The same happens in my DataGridView, when I change for example the column width manually and the method is called again the UI is refreshed.

user925715
  • 11
  • 1

0 Answers0