D
Doug Bell
Hi,
I have a function that loads Rows from a field in a DataTable into an
ArrayList.
See below:
It also adds a Row (eg "All Areas").
I wanted this new row to be the first record so I added a preceeding space
(eg " All Areas") and sorted the ArrayList.
I have just found that there are some valid records that have one or more
spaces so my added record is no longer first item in the list.
Is there a way to create a custom sort for the ArrayList so that my added
item is first in the list?
Thanks
Doug
Private Function dacFillCombo(ByVal stTblNam As String, ByVal stDspFld As
String, _
ByVal stDsplVal As String) As ArrayList
Dim dr As DataRow, al As New ArrayList
Try
al.Add(stDsplVal)
For Each dr In dsFiles.Tables(stTblNam).Rows
al.Add(dr(stDspFld).ToString)
Next
al.Sort()
Return al
Catch ex As Exception
MsgBox(ex.ToString)
End Try
End Function
I have a function that loads Rows from a field in a DataTable into an
ArrayList.
See below:
It also adds a Row (eg "All Areas").
I wanted this new row to be the first record so I added a preceeding space
(eg " All Areas") and sorted the ArrayList.
I have just found that there are some valid records that have one or more
spaces so my added record is no longer first item in the list.
Is there a way to create a custom sort for the ArrayList so that my added
item is first in the list?
Thanks
Doug
Private Function dacFillCombo(ByVal stTblNam As String, ByVal stDspFld As
String, _
ByVal stDsplVal As String) As ArrayList
Dim dr As DataRow, al As New ArrayList
Try
al.Add(stDsplVal)
For Each dr In dsFiles.Tables(stTblNam).Rows
al.Add(dr(stDspFld).ToString)
Next
al.Sort()
Return al
Catch ex As Exception
MsgBox(ex.ToString)
End Try
End Function