adding an object to a datarow cell?

Is there any way to add an object to a datarow cell or can a cell only have text   I have a datagrid and when I click on a certain cell, I'm trying to take that cell information and display more information based off of the cell info.  So, my original thought was to take the column name (which is a field in the database) and the first cell in that row (which is a date) and using those 2 pieces of info, create a query that would show how the currentcell's info was created.  I couldn't find any properties for the currentcell other than number, so I can't seem to get at the column header info.  

My next thought was that if I could just create a custom object that would store the date and the fieldname and then add that to my cell when it's created, then when I click on it, I'd maybe be able to get that object back and query it for the info. 

Anyone have any other ideas how to do this   Thanks!


Answer this question

adding an object to a datarow cell?

  • actinium.ga

    Hey Rkimble, yes it is still the time tracker.  I already converted the vb to c# and it's all working fine now.  I just wasn't sure about the objects in the grid cell.  I figured I probably could use an object and then make sure it's tostring just spit out the data.  Unfortunately, I've gotten tied up on another project for the time being, but when I can get back on this, maybe I can email you and we can work on this together if you wanted to.  Shoot me your email if you want at cakewalkr7[at]sbcglobal[dot]net.
  • rezaA

    You could put most any type of object in a DataGrid cell, but the textboxes are only going to show you a string representation of that object.

    If you apply a TableStyle to the grid and map your columns, then you can use the following line of code to get the column name when the user clicks a cell:

    DataGrid1.TableStyles(0).GridColumnStyles(DataGrid1.CurrentCell.ColumnNumber).HeaderText

    Is this still an attempt to build your TimeEntry report (same project as your other post)   Do you want to work 1on1 to covert my VB example to C#

  • adding an object to a datarow cell?