How do I get datagrid's cell text ?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

hi,

how would i get a datagrid's cell's text ?
i know the events that will tell me which cell i clicked on for
the row and column #'s, but cant find the properties to
get the text (i.e. "hello world" from row 1, column1). any know ?

thanks,
lee
 
Lee,
Datagrids are designed to be bound to some table or two dimensional object.
If you know the row and column you then simply go to the corresponding row
and column in the bound source.

Regards
 
I hope this helps

Try
Dim hti As System.Windows.Forms.DataGrid.HitTestInfo

hti = Me.dgAssignedCalls.HitTest(e.X, e.Y)

If hti.Type <> DataGrid.HitTestType.None Then
Me.intRowNumber = hti.Row
Me.intCallNumber = Me.objDsAssignedCalls.Tables("tbl_CallDetails").Rows(intRowNumber)("CallNo")

Dim NewfrmWorkCall As New frmWorkCall
NewfrmWorkCall.dspCallNumber.Text = intCallNumber
NewfrmWorkCall.ShowDialog()
End If
Catch ex As Exception
End try
 
I hope this helps you,

Private Sub dgCriticalCalls_MouseDown(ByVal sender As Object, ByVal a As System.Windows.Forms.MouseEventArgs) Handles dgCriticalCalls.MouseDown
Try
Dim hti As System.Windows.Forms.DataGrid.HitTestInfo

hti = Me.dgCriticalCalls.HitTest(a.X, a.Y)

If hti.Type <> DataGrid.HitTestType.None Then
Me.intRowNumber = hti.Row
Me.intCallNumber = Me.objDsCriticalCalls.Tables("tbl_CallDetails").Rows(intRowNumber)("CallNo")

Dim NewfrmAssignCall As New frmAssignCall
NewfrmAssignCall.dspCallNumber.Text = intCallNumber
NewfrmAssignCall.ShowDialog()
End If
Catch ex As Exception
Call ErrorMessage()
End Try
End Sub
 
I hope this helps you,

Private Sub dgCriticalCalls_MouseDown(ByVal sender As Object, ByVal a As System.Windows.Forms.MouseEventArgs) Handles dgCriticalCalls.MouseDown
Try
Dim hti As System.Windows.Forms.DataGrid.HitTestInfo

hti = Me.dgCriticalCalls.HitTest(a.X, a.Y)

If hti.Type <> DataGrid.HitTestType.None Then
Me.intRowNumber = hti.Row
Me.intCallNumber = Me.objDsCriticalCalls.Tables("tbl_CallDetails").Rows(intRowNumber)("CallNo")

Dim NewfrmAssignCall As New frmAssignCall
NewfrmAssignCall.dspCallNumber.Text = intCallNumber
NewfrmAssignCall.ShowDialog()
End If
Catch ex As Exception
Call ErrorMessage()
End Try
End Sub
 

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