Buenos dias compañeros mi inquietud es la siguiente: estoy utilizando una función recursiva para llenar mi control TreeView a partir de unos datos de mis tablas de esta manera:
Agradesco sus respuestas y comentarios al respecto.
Saludos.
Código:
Hasta hay no tengo ningún problema todo funciona bien, mi pregunta es: si se dan cuenta en la propiedad Tag del Control Hnodo.Tag = Trim(RegistroL("COMPRT_02")), estoy agregando un código que quisiera que al momento de seleccionar y arrastrar, cualquiera de mis nodos, hacia un cuadro de texto me apareciera dicho código en el mismo.Public Function Cargar_Nodos(ByVal nodo As TreeNode, ByVal criterio As String) As Boolean Consulta = "SELECT PARPRT_02, COMPRT_02, PMDES1_01, LLC_01 FROM Product_Structure AS s INNER JOIN Part_Master as p ON s.COMPRT_02 = p.PRTNUM_01 WHERE PARPRT_02 = '" & Trim(criterio) & "' ORDER BY COMPRT_02 DESC" Adaptador = New Odbc.OdbcDataAdapter(Consulta, Conexion) Sdataset = New DataSet Try Adaptador.Fill(Sdataset, "Product_Structure") Catch ex As Exception MessageBox.Show("Se ha producido un error llenar el Dataset:" & vbCrLf & ex.Message) End Try 'VERIFICAR EL NÚMERO DE FILAS QUE DEVUELVE LA CONSULTA If Sdataset.Tables(0).Rows.Count = 0 Then Return False Else Try Sdatatable = Sdataset.Tables("Product_Structure") Catch ex As Exception MessageBox.Show("Se ha producido un error llenar el Datatable:" & vbCrLf & ex.Message) End Try 'CREACIÓN DEL NODO Dim Hnodo As TreeNode Dim RegistroL As DataRow 'LEER EL DATAROW DE LOS REGISTROS For Each RegistroL In Sdatatable.Rows Hnodo = nodo.Nodes.Add(Trim(RegistroL("COMPRT_02")), Trim(RegistroL("PMDES1_01")), 2, 1) Hnodo.Tag = Trim(RegistroL("COMPRT_02")) Hnodo.ExpandAll() 'LLAMAR A LA FUNCIÓN RECURSIVA Cargar_Nodos(Hnodo, RegistroL("COMPRT_02")) Next Return True End If End Function
Agradesco sus respuestas y comentarios al respecto.
Saludos.