vks.gautam1
Well-known member
i want to send data from list box to datagridview. so first i tried to fill dataTable.then add that to dataset. then add data to datagridview.
Is this right way
It is giving error=column required valid data type
there is problem in adding data from listbox to data row.
Is this right way
It is giving error=column required valid data type
VB.NET:
Dim ds As New DataSet
dim i as integer
Dim table As New DataTable("list")
Dim dat As DataColumn = New DataColumn("Dat")
dat.DataType = System.Type.GetType("System.string")
table.Columns.Add(dat)
Dim dr1 As DataRow
For i = 0 To ListBox1.Items.Count - 1
dr1 = table.NewRow
For j As Integer = 0 To ListBox1.Items.Count - 1
dr1(j) = ListBox1.Items(j).ToString
Next
table.Rows.Add(dr1)
Next
ds.Tables.Add(table)
DataGridView1.DataSource = ds.Tables(0)
there is problem in adding data from listbox to data row.