|
Imports Curion.WPF.Data
Public Class MakeClass
Public Function MakeItem(def As String) As List.Row
Dim cls = MakeClass(def)
cls.Rows.NewRow()
Return cls.Rows(0)
End Function
Public Function MakeItems(def As String) As List.DataList
Dim cls = MakeClass(def)
For i = 1 To 10
cls.Rows.NewRow()
Next
Return cls
End Function
Private Function MakeClass(def As String) As List.DataList
Dim lines() = Split(def, vbCrLf)
Dim cls As New List.DataList
For Each item In lines
If item = String.Empty Then Continue For
Dim parts() = Split(item, ",")
Dim name As String = parts(0)
Dim type As String = "String"
If parts.Length > 1 Then type = parts(1)
Select Case LCase(type)
Case "string" : type = "System.String"
Case "integer" : type = "System.Int32"
Case "boolean" : type = "System.Boolean"
Case "date" : type = "System.DateTime"
Case "long" : type = "System.Int64"
Case "decimal" : type = "System.Decimal"
End Select
Dim workType = System.Type.GetType(type)
cls.Columns.Add(name, , workType)
Next
Return cls
End Function
End Class
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
I enjoy my wife, living in the woods, my 7 dogs, and learning new things. I like to play with UI stuff and model based coding.