how to move text box on data grid in c# and edit data in textbox and after copy to the grid .............
help please
Move text box on gride
1 Answer
Know the answer? Post it. Somebody with the same question will find it here.
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
joakim wireen46 reputationPosted Apr 2, 2009, 1:30 PM EDT
Hello!
I take it from that you allreday have a datagridview with data in it. If so add a cell click event and apply this code :
int row, cell; private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e){
row = e.RowIndex;
cell = e.ColumnIndex;
}
And there you got yourself the row and colum index, with this information you can easisly do what you requested.
For instance this is how you GET the value :
dataGridView1.Rows[row].Cells[cell].Value = textBox1.Text;
And this is how you SET the value :
textBox1.Text = (
string)dataGridView1.Rows[row].Cells[cell].Value;I hope that made sence cause it's in the middle of the night and I dont know what the fuck I'm doing anymore :)