Hi
I have a datagrid that have checkboxes added to it and there is also a
button that I want to use as a check what rows has been selected in
the datagrid. But when I use this piece if code the program just
close when I press the button that is supposed to show the selected
rows in the datagrid
<code>
Public Function GetSelectedRows (ByVal dg As DataGrid) As
System.Collecti ons.ArrayList
Dim al As New ArrayList
Dim cm As CurrencyManager = Me.BindingConte xt(dg.DataSourc e,
dg.DataMember)
Dim dv As DataView = CType(cm.List, DataView)
Dim i As Integer
For i = 0 To dv.Count - 1
If dg.IsSelected(i ) Then
al.Add(i)
End If
End
Next
Return al
End Function 'GetSelectedRow s
Private Sub btnMakePDF_Clic k(ByVal sender As Object, ByVal e As
System.EventArg s) Handles btnMakePDF.Clic k
Dim s As String = "Selected rows:"
Dim o As Object
For Each o In GetSelectedRows (MyDataGrid)
s += " " + o.ToString()
Next o
MessageBox.Show (s)
'MessageBox.Sho w("Selected items....")
End Sub 'button1_Click
</code>
Does anyone know why?
Regards
Magnus
Posted Via Usenet.com Premium Usenet Newsgroup Services
----------------------------------------------------------
** SPEED ** RETENTION ** COMPLETION ** ANONYMITY **
----------------------------------------------------------
http://www.usenet.com