Home
>
Windows Forms > DataGrid Component Calibration
DataGrid Component Calibration
September 5th, 2009
admin
// Autogenerated index fields when inserting new row is attemted
DataGridView_DefaultValuesNeeded (object sender, DataGridViewRowEventArgs e)
{
e.Row.Cells[Index1].Value = Value1;
e.Row.Cells[Index2].Value = Value2;
}
// Make first column disapear
DataGridViewName.RowHeadersVisible = false;
// Alternate Row Color
DataGridViewName.AlternatingRowsDefaultCellStyle = { BackColor=Color [A=255, R=192, G=255, B=255] };
// Dont let borders if headers are few
DataGridViewName.AutoSizeColumnMode = Fill;
// SelectEntireRow if selected
DataGridViewName.SelectionMode = "FullRowSelect";
// Go the new row of a datagrid and call the valuesneeded event
BindingSource.AddNew();