how to move text box on data grid in c# and edit data in textbox and after copy to the grid .............
help please
Loading
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
joakim wireenPosted Apr 2, 2009, 5:30 PM
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 :)