ayuda! treeview con identificador
Publicado por Dark_zen (4 intervenciones) el 19/05/2011 17:38:40
hola que tal como dice en el titulo
deseo llenar un treeview con datos de esta tabla
"select ID,IDG,DSCL FROM OFICINA"
ID es el identificador
IDG es el que agrupa los nodos
DSCL es la descripcion
buscando en la web me encontre con esto
TreeNode n = treeView1.Nodes.Add("key", "value")
como aplicar a este codigo:
fuente:
http://www.elguille.info/colabora/NET2005/svalsse_llenar_un_treeview.htm
Private Sub CrearNodosDelPadre(ByVal indicePadre As Integer, ByVal nodePadre As TreeNode)
Dim dataViewHijos As DataView
dataViewHijos = New DataView(dataSetArbol.Tables("TablaArbol"))
dataViewHijos.RowFilter = dataSetArbol.Tables("TablaArbol").Columns("IdentificadorPadre").ColumnName + " = " + indicePadre.ToString()
For Each dataRowCurrent As DataRowView In dataViewHijos
Dim nuevoNodo As New TreeNode
nuevoNodo.Text = dataRowCurrent("NombreNodo").ToString().Trim()
If nodePadre Is Nothing Then
TreeView1.Nodes.Add(nuevoNodo)
Else
' se añade el nuevo nodo al nodo padre.
nodePadre.Nodes.Add(nuevoNodo)
End If
CrearNodosDelPadre(Int32.Parse(dataRowCurrent("IdentificadorNodo").ToString()), nuevoNodo)
Next dataRowCurrent
End Sub
deseo llenar un treeview con datos de esta tabla
"select ID,IDG,DSCL FROM OFICINA"
ID es el identificador
IDG es el que agrupa los nodos
DSCL es la descripcion
buscando en la web me encontre con esto
TreeNode n = treeView1.Nodes.Add("key", "value")
como aplicar a este codigo:
fuente:
http://www.elguille.info/colabora/NET2005/svalsse_llenar_un_treeview.htm
Private Sub CrearNodosDelPadre(ByVal indicePadre As Integer, ByVal nodePadre As TreeNode)
Dim dataViewHijos As DataView
dataViewHijos = New DataView(dataSetArbol.Tables("TablaArbol"))
dataViewHijos.RowFilter = dataSetArbol.Tables("TablaArbol").Columns("IdentificadorPadre").ColumnName + " = " + indicePadre.ToString()
For Each dataRowCurrent As DataRowView In dataViewHijos
Dim nuevoNodo As New TreeNode
nuevoNodo.Text = dataRowCurrent("NombreNodo").ToString().Trim()
If nodePadre Is Nothing Then
TreeView1.Nodes.Add(nuevoNodo)
Else
' se añade el nuevo nodo al nodo padre.
nodePadre.Nodes.Add(nuevoNodo)
End If
CrearNodosDelPadre(Int32.Parse(dataRowCurrent("IdentificadorNodo").ToString()), nuevoNodo)
Next dataRowCurrent
End Sub
Valora esta pregunta


0