Hi @Rahul Kumar , Welcome to Microsoft Q&A,
Updated:
the problem has been solved . it was due to dirty cell that the value was null everytime .
Try to use the code bellow.
if (columnIndex == 0 && !string.IsNullOrEmpty(CurrentCell.Value?.ToString()) && keyData == (Keys.Control | Keys.Enter))
{
ItemEdit edit = new ItemEdit();
Point PositionX = this.Parent.PointToScreen(Point.Empty);
int LeftScreenX = PositionX.X;
Point PositionY = this.Parent.PointToScreen(Point.Empty);
int TopScreenY = PositionY.Y;
edit.StartPosition = FormStartPosition.Manual;
edit.Location = new Point(LeftScreenX, TopScreenY);
edit.ShowInTaskbar = false;
edit.label1.Text += "Alteration";
edit.textbox1data = CurrentCell.Value?.ToString();
if (edit.ShowDialog() == DialogResult.Yes)
{
this.Rows[rowIndex].Cells[columnIndex].Value = edit.textbox1data;
this.EndEdit();
}
return true;
}
Best Regards,
Jiale
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.