c# - Change color of a cell of a datagridview inside a tabpanel -
i got tabcontrol 2 tabpanels inside. tabpanels contains datagridview , i'm trying change color of cell. if change color of first datagrid contained in first tabpanel works. if same other tabpanel code didn't nothing.
dgvinthefirsttabpanel.rows[0].cells[6].style.backcolor = color.yellow;
this work fine, but...
dgvinthesecondtabpanel.rows[0].cells[6].style.backcolor = color.yellow;
this didn't work, think problem change of tab panel active.
i solve problem, exist bug don't recognize tabs if didn't click inside 1 of them. solve can in load of form. in way can modify objects contain in others tab.
private void main_load(object sender, eventargs e) { //scan tabs tabcontrol1.selectedtab = tabcontrol1.tabpages[1]; tabcontrol1.selectedtab = tabcontrol1.tabpages[2]; tabcontrol1.selectedtab = tabcontrol1.tabpages[0]; ... } best regards
then can modify color of cell or property of datagrid.
Comments
Post a Comment