User Control - DataGridView with combobox columns

Trying to build a simple User Control to populate dataGridView with a Table data. Scenario - Table1: RegionID, Region, ManagerID; Table2: PersonID, Name. I'd like to display Region and Name in the grid where the 2nd column is a combobox with all names from Table 2 and also each cell in the col 2 has value based on ManagerID = PersonID. The code is working fine when it's a win app without user control.

dGrRegions.DataSource = ds.Tables[0]; (ds Dataset SELECT RegionID, Region, ManagerID FROM Table1)

dGrRegions.Columns[0].Visible = false;
dGrRegions.Columns[2].Visible = false;

var column = new DataGridViewComboBoxColumn();
column.DataPropertyName = "PersonID";

column.DataSource = dsPeople.Tables[0]; (Dataset SELECT PersonID, Name...)
column.ValueMember = "PersonID";
column.DisplayMember = "Name";
column.HeaderText = "Manager";

dGrRegions.Columns.Add(column);

but when I create a control and pass all needed info as parameters all works fine except that the col 2 doesn't show current values (combo list is built ok)

Any idea?
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories