In addition to solution#1 by
Richard Deeming[
^], you can add computed/expression column to your
DataTable
object. Please, read:
Creating Expression Columns | Microsoft Docs[
^]
DataColumn.Expression Property (System.Data)[
^]
It's quite simple to achieve that:
Dim dc AS DataColumn = New DataColumn("ClassName", Type.GetTYpe("System.String"))
dc.Expression = "IIF(class=3, 'a', IIF(class=5, 'b', IIF(class=8, 'c', 'uknknown')))"
dtAll.Columns.Add(dc)
That's all!