Show cell content in a DataGrid

  • Thread starter Thread starter Diego F.
  • Start date Start date
D

Diego F.

Hello. How can I use the content of any cell in a DataGrid. For example, I
want to show the content of a cell when I click it.

Regards,

Diego F.
 
Using the 2 dimensional indexer for the collection row, column e.g.

[VB]
MessageBox.Show(DataGrid.Item(0,0))

[C#]
MessageBox.Show(dataGrid1[0,0].ToString());

For the currently selected cell use the CurrentCell property:-

Peter
 
Thank you. It was easier than I thought ;-)

One more thing please. In the dataGrid I have in each row a column with a
numeric value that is what I need to use. Can I select this column even the
user press other column in the row?

Regards,

Diego F.

Peter Foot said:
Using the 2 dimensional indexer for the collection row, column e.g.

[VB]
MessageBox.Show(DataGrid.Item(0,0))

[C#]
MessageBox.Show(dataGrid1[0,0].ToString());

For the currently selected cell use the CurrentCell property:-

Peter

--
Peter Foot
Windows Embedded MVP
OpenNETCF.org Senior Advisor
www.inthehand.com | www.opennetcf.org

Diego F. said:
Hello. How can I use the content of any cell in a DataGrid. For example, I
want to show the content of a cell when I click it.

Regards,

Diego F.
 
OK, if the column is always the same, just doint
dataGrid1[currentCell.RowNumber, 3]; it must work :-)

Regards,

Diego F.


Diego F. said:
Thank you. It was easier than I thought ;-)

One more thing please. In the dataGrid I have in each row a column with a
numeric value that is what I need to use. Can I select this column even the
user press other column in the row?

Regards,

Diego F.

Peter Foot said:
Using the 2 dimensional indexer for the collection row, column e.g.

[VB]
MessageBox.Show(DataGrid.Item(0,0))

[C#]
MessageBox.Show(dataGrid1[0,0].ToString());

For the currently selected cell use the CurrentCell property:-

Peter

--
Peter Foot
Windows Embedded MVP
OpenNETCF.org Senior Advisor
www.inthehand.com | www.opennetcf.org

Diego F. said:
Hello. How can I use the content of any cell in a DataGrid. For
example,
 
Back
Top