dt = dt.AsEnumerable().Take(1).Select(Function(row)
row.ItemArray = row.ItemArray.Select(Function(cell, index)
If Decimal.TryParse(cell.ToString(), Nothing) Then
Return Decimal.Parse(cell.ToString())
ElseIf dt.AsEnumerable().Skip(1).All(Function(r) Not Decimal.TryParse(r(index).ToString(), Nothing)) Then
Return DBNull.Value
Else
Return cell
End If
End Function).ToArray()
Return row
End Function).CopyToDataTable()
Invoke Code Arguments: dt: Direction = In/Out, Type = DataTable
updatedTable = dt.Clone()
Dim firstRow As DataRow = dt.AsEnumerable().First()
For Each col As DataColumn In dt.Columns
Dim foundNumeric As Boolean = False
Dim numericValue As Decimal
For Each row As DataRow In dt.Rows
If Decimal.TryParse(row(col).ToString(), numericValue) Then
firstRow(col) = numericValue
foundNumeric = True
Exit For
End If
Next
If Not foundNumeric Then
firstRow(col) = DBNull.Value
End If
Next
updatedTable.Rows.Add(firstRow)
dt = updatedTable
Invoke Code Arguments: dt : Direction = In, Type = DataTable updatedTable : Direction = Out, Type = DataTable