参考代码
Dim dt As DataTable = DataTables("表设置")
For Each bm As String In dt.GetValues("表名")
For Each c As Col In Tables(bm).Cols
c.visible = False
Next
For Each dr As DataRow In dt.Select("表名 = '" & bm & "' and 显示 = true")
Dim c As Col = Tables(bm).Cols(dr("列名"))
c.Visible = True
c.Caption = dr("标题")
c.Width = dr("列宽")
Next
DataTables(bm).BuildHeader
Next