Hi
experts
i m using this code for create new table and add data in this table from old table,
but i need to sort or filter my old table before adding new table,
how i can this?
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
'Create the table
Dim Table1 As DataTable
Table1 = New DataTable
Table1.Columns.Add("Id", Type.GetType("System.Int32"))
Table1.Columns.Add("Name", Type.GetType("System.String"))
Dim Row As DataRow
Dim i As Integer
For i = 0 To ds.Tables("bname").Rows.Count - 1
Row = Table1.NewRow()
Row("id") = ds.Tables("bname").Rows(i)("bookid")
Row("name") = ds.Tables("bname").Rows(i)("bname")
Table1.Rows.Add(Row)
Next
TextBox2.Text = Table1.Rows.Count
If ds.Tables.Contains("table1") = True Then
ds.Tables.Remove("table1")
End If
ds.Tables.Add("table1")
Dim j, rp, t As Integer
t = Table1.Rows.Count - 1
TextBox1.Text = t
rp = 0
For j = 0 To t
lbbname.Items.Add(Table1.Rows(j)("id"))
rp += 1
Next
End Sub