tags:

views:

177

answers:

2

hi guys,

In a vb.net Windows Application, I have a datatable wich is not from a database. I want to add a new row, but when I add a new row only the new row is in the datatable, not the existing data.

dim dt as datatable treelist.datasource=dt this is existing item here in any event i want to add the new row in the datatable so that new node is added to the treelist

thanks for your help....

+1  A: 

See following:
http://www.vb-helper.com/howto%5Fnet%5Fruntime%5Fdatatable.html

Brij
+1  A: 

You should be able to declare a new row and add it to the DataTable as such:

'Create the new row
Dim newRow as DataRow = myTable.NewRow

'Add some data to it
newRow("columnName1") = data1
newRow("columnName2") = data2

'Add it to the table
myTable.Rows.Add(newRow)

'Bind the table
treeList.DataSource = dt
treeList.DataBind

That should work, just make sure you add the row to the DataTable before you bind it to the TreeView object.

David Hague