I have a DataGridView which was the subject of a previous question (link). But sometimes the Button is null. This is fine. But if it is null, is th
Handle custom painting and paint a textbox over there.
void dataGridView1_CellPainting(object sender, DataGridViewCellPaintingEventArgs e)
{
if (e.ColumnIndex == yourColumnIndex && String.IsNullOrEmpty((string)e.FormattedValue))
{
Graphics g = e.Graphics;
TextBoxRenderer.DrawTextBox(g, e.CellBounds,
System.Windows.Forms.VisualStyles.TextBoxState.Normal);
e.Handled = true;
}
}