By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,333 Members | 1,060 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,333 IT Pros & Developers. It's quick & easy.

How do I get datagrid's cell text ?

P: n/a
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
Nov 20 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
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
"Lee Holsenbeck" <Le***********@discussions.microsoft.com> wrote in message
news:B6**********************************@microsof t.com...
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

Nov 20 '05 #2

P: n/a
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").Ro ws(intRowNumber)("CallNo")

Dim NewfrmWorkCall As New frmWorkCall
NewfrmWorkCall.dspCallNumber.Text = intCallNumber
NewfrmWorkCall.ShowDialog()
End If
Catch ex As Exception
End try
Nov 20 '05 #3

P: n/a
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").Ro ws(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
Nov 20 '05 #4

P: n/a
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").Ro ws(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
Nov 20 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.