ZooFlow: Add My.Helpers

This commit is contained in:
Jonathan Jenne
2021-10-26 11:06:04 +02:00
parent 72c50a298a
commit f5c0a18a59
6 changed files with 125 additions and 72 deletions

View File

@@ -85,27 +85,4 @@ Module ModuleHelpers
End Try
Return connectionString
End Function
Public Function FilterDatatable(pDatatable As DataTable, pFilterString As String, pCheckColumn As String, pSortString As String, pReturnDataTable As Boolean) As Object
Try
If pDatatable.Rows.Count = 0 Then
Return Nothing
End If
Dim oDataView As DataView = pDatatable.DefaultView
oDataView.RowFilter = pFilterString
If oDataView.Count = 1 And pReturnDataTable = False Then
Dim oView As DataRowView = oDataView.Item(0)
Dim oRow As DataRow = oView.Row
Return oRow.Item(pCheckColumn)
Else
Dim oDataTableCopy As DataTable = New DataTable()
oDataTableCopy = pDatatable.Select(pFilterString, pSortString).CopyToDataTable()
Return oDataTableCopy
End If
Catch ex As Exception
MsgBox("Unexpected Error in FilterDatatable: " + ex.Message, MsgBoxStyle.Critical)
Return Nothing
End Try
End Function
End Module