Hi all
please help me solve this problem that is making me mad.
i have a grid with a template col that has a check box. i wish to create a
string of teh key values for teh rows that have been checked by the user.
with the help of the message on this forum - i got an idea of teh code
from the articles on the MS website. but it is not working...
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
' Walk the grid looking for selected rows
Dim i As Integer = 0
Dim cb As CheckBox
Dim dgi As DataGridItem
Dim MCode As Integer
Dim str As String
For Each dgi In dgMachines.Items
cb = CType(dgi.FindControl("chkDel"), CheckBox)
If cb.Checked Then
' Determine the key of the selected record ...
MCode = CType(dgMachines.DataKeys(i), Integer)
' ... get a pointer to the corresponding dataset record ...
str = str + MCode.ToString
End If
i += 1
Next
End Sub
**************
when i run the app - upon click i get the error that
Object reference not set to an instance of an object.
What is wrong??
please help:(
thanks
regards
Arti Mahendra Sharma