none
How to access DataGrid Cells RRS feed

  • Question

  • When my Data Grid returns results and i click and Highlight an entire cell...I want to see that information for the Cell i selected in another form in my project

     

    Private Sub dgshow_DoubleClick(ByVal sender As Object, ByVal e As System.EventArgs) Handles dgshow.DoubleClick

    MsgBox(dsWatchTracker.Tables("tblWatchInstance").Rows(dgshow.CurrentCell.RowNumber).Item("watchid").ToString())

    End Sub

     

    This is what i have came up with so far but i get an...Object not set to an instance of an object on this issue....any help would be great.

    Thursday, February 23, 2006 9:56 PM

Answers

  • Hi!

    C# Code would look like this.

    DataGridView.Rows[index].Cells["CellName"].Value;

    VB

    DataGridView.Rows(index).Cells("CellName").Value

    cheers

     

    Thursday, February 23, 2006 10:05 PM

All replies

  • Hi!

    C# Code would look like this.

    DataGridView.Rows[index].Cells["CellName"].Value;

    VB

    DataGridView.Rows(index).Cells("CellName").Value

    cheers

     

    Thursday, February 23, 2006 10:05 PM
  • Rows is not a member of the datagrid, Is there another way this can be done??

    dgshow.Rows(index).Cells("WatchID").Value()

    Friday, February 24, 2006 1:05 PM
  • Hi!

    Its always good to mention details about the framework version you are using. I thought you are using .Net 2 where Rows is member.

    Friday, February 24, 2006 9:21 PM