Help!!

I need to get the text or value displayed in datagridview columns.
how can i do this?


regards
Jineesh

Hi,

What you need is to use the following code:

this.dataGridView1[columnIndex,rowIndex];

Enjoy!

commented: Very quick +5

Rows and Cells collection of DataGridView control.

// First Row and first column
DataGridView1.Rows[0].Cells[0].Value 
DataGridView1.Rows[0].Cells[1].Value  // 2nd column
...

Yes, this.dataGridView1[columnIndex,rowIndex] indexer returns an instance of DataGridViewCell.

You may have to use the DataGridView1.Rows[0].Cells[0].EditedFormattedValue to see the current value until the DataGrid gets updated. EditedFormattedValue displays the value currently whether or not it has been updated to the BindingSource, or the DataGrid.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.