datgrid help

  • Thread starter Thread starter Richard Fagen
  • Start date Start date
R

Richard Fagen

Hi,

Is there a simple way to read the current value in a datagrid's cell?

I know how to use
Grid.CurrentCell.RowNumber
Grid.CurrentCell.ColumnNumber
but these give me the co-ordinates of the cell. I'd like to know about
the contents of the cell, especially the current values. (type, width,
etc would be nice too)

I tried using the binding context, but that gets me the current row and
I am not sure how to then read (and later update) the selected cell.

I searched the web and there are many third party add-ins, I am sure I
am missing something that is already there.

Thanks

Richard

p.s. Are there any good books or websites to help learn datagrids?
 
Hi,

http://msdn.microsoft.com/library/d...ndowsformsdatagridclassgetcellboundstopic.asp

Ken
-------------------
Hi,

Is there a simple way to read the current value in a datagrid's cell?

I know how to use
Grid.CurrentCell.RowNumber
Grid.CurrentCell.ColumnNumber
but these give me the co-ordinates of the cell. I'd like to know about
the contents of the cell, especially the current values. (type, width,
etc would be nice too)

I tried using the binding context, but that gets me the current row and
I am not sure how to then read (and later update) the selected cell.

I searched the web and there are many third party add-ins, I am sure I
am missing something that is already there.

Thanks

Richard

p.s. Are there any good books or websites to help learn datagrids?
 
Hi Ken,

When I was browsing MSDN, I saw that method, "DataGrid.GetCellBounds"
but it "Gets the Rectangle that specifies the four corners of a cell."

This isn't what I was looking for. I am looking for the contents of the
cell, ie "What is the value of the data the user clicked on in the
datagrid?"

Am I misunderstanding something and the GetCellBounds can do this?

Richard
 
Hi,

Saw you were looking for cell width and stopped reading. You get
the cell value with the datagrid.item property

http://msdn.microsoft.com/library/d...fsystemwindowsformsdatagridclassitemtopic.asp

Ken
-------------
Hi Ken,

When I was browsing MSDN, I saw that method, "DataGrid.GetCellBounds"
but it "Gets the Rectangle that specifies the four corners of a cell."

This isn't what I was looking for. I am looking for the contents of the
cell, ie "What is the value of the data the user clicked on in the
datagrid?"

Am I misunderstanding something and the GetCellBounds can do this?

Richard
 
Hi Ken,

That link is more like it :)
That was exactly what I was looking for. Thanks!

Richard
 

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

Back
Top