datagrid raw

S

Simon Abolnar

I would like to read data from datagrid.
How can I read one cell from datagrid (raw, column).

How can I find out total numbers of raws.

Thanks for help,

Simon
 
S

Scott Mitchell [MVP]

Simon said:
I would like to read data from datagrid.
How can I read one cell from datagrid (raw, column).

How can I find out total numbers of raws.

By "raw" I assume you mean "row"...

You can determine the total number of rows using the following property:

DataGridID.Items.Count

You can access a particular cell of the DataGrid using the following code:

'VB.NET
Dim cell as TableCell = DataGridID.Items(rowIndex).Cells(colIndex)

// C#
TableCell cell = DataGridID.Items[rowIndex].Cells[colIndex];

Once you have the TableCell instance you can read the text contents via
the .Text property. (If it's a TemplateColumn you will need to work
through the control hierarchy... see the following two FAQs for how to
programmatically work with the contents of BoundColumns and TemplateColumns:

http://datawebcontrols.com/faqs/ProgrammaticAccess/AccessingBoundColumnContents.shtml
http://datawebcontrols.com/faqs/ProgrammaticAccess/AccessingTemplateColumnContents.shtml

hth
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,743
Messages
2,569,478
Members
44,898
Latest member
BlairH7607

Latest Threads

Top