locked
getting a binded object from a Datagrid selected cell RRS feed

  • Question

  • Hi Guys,

    I have a list of objects bound to a datagrid. When i click on the cell, how can i get the binded object of that row?  As i want to access a certain property that is not added as a column on the datagrid.

    I can get the row id through this

    Dim hti As DataGrid.HitTestInfo = Me.grdManageDefects.HitTest(e.X, e.Y)
    
    
    
    
    
    
    
    
    thanks for any help
    Tuesday, December 21, 2010 12:50 PM

Answers

  • OK i worked it out.

    use

     cManager = CType(<datagrid>.BindingContext(<ListOfObjects>), CurrencyManager)
    
     cManager.Current 'gets the current item
    • Marked as answer by Eddm Tuesday, December 21, 2010 3:13 PM
    Tuesday, December 21, 2010 3:09 PM

All replies

  • OK i worked it out.

    use

     cManager = CType(<datagrid>.BindingContext(<ListOfObjects>), CurrencyManager)
    
     cManager.Current 'gets the current item
    • Marked as answer by Eddm Tuesday, December 21, 2010 3:13 PM
    Tuesday, December 21, 2010 3:09 PM
  • Hi Eddm

     Thank you for sharing your solutions & experience here. It will be very beneficial for other community members who have similar questions.

     

    Best regards,

    Brave


    Brave Zhou [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Thursday, December 23, 2010 2:23 AM