I'm using vb.net / winforms. How can I convert 10 lines with three columns into a DataSet/DataTable?
Lines are something like this:
Item-1, $100, 44
Item-2, $42, 3
etc
Dim Table1 As DataTable
Table1 = New DataTable("TableName")
Dim column1 As DataColumn = New DataColumn("Column1")
column1.DataType = System.Type.GetType("System.String")
Dim column2 As DataColumn = New DataColumn("Column2")
column2.DataType = System.Type.GetType("System.Int32")
Dim column3 As DataColumn = New DataColumn("Column2")
column3.DataType = System.Type.GetType("System.Int32")
Table1.Columns.Add(column1)
Table1.Columns.Add(column2)
Table1.Columns.Add(column3)
Dim Row1 As DataRow
Row1 = Table1.NewRow()
Row1.Items("Column1") = "Item1"
Row1.Items("Column2") = 44
Row1.Items("Column3") = 99
Table1.Rows.Add(Row1)
' Repeat for other rows
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With