0
votes

I might be doing something wrong but...

I have a datagridview. Its DataSource is BindingSource which has a table as a DataSource. I created a combobox in the datagridview and filled it using:

col.Name = "employee_comb";
col.DisplayMember = "work";
col.ValueMember = "work_id";
col.DataPropertyName = "work";

col.DataSource = bs;
dataGridView1.Columns.Insert(3, col);

work contains string and work_id contains int.

I also have CurrentCellDirtyStateChanged event to check for changes.

The problem is: when I select another item in the combobox list, the datagridview automatically changes its CurrentRow to the CurrentRow with an "id" (first column) equal to ValueMember of combobox item. How do I stop it from switching?

1

1 Answers

0
votes

It seems the problem occurred because datagridview and datagridviewcombobox had the same DataSource. I created new BindingSource and it works like charm!