|
|
|
![]() |
|
Strumenti |
![]() |
#1 |
Senior Member
Iscritto dal: Aug 2000
Messaggi: 1209
|
[VB.NET] Aggiungere un nodo figlio al TreeView
Mi funziona tutto per la visualizzazione e la raccolta dei dati, solamente che manca l'ultimo dettaglio,
voglio creare l'evento " TreeView1.AfterSelect " e poi " TreeView1.BeforeExpand " ma sensa un nodo figlio non posso farlo, come faccio per creare un figlio li ???? Codice:
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load TreeView1.BeginUpdate() TreeView1.Nodes.Clear() oConn.Open() Dim oComm As New SqlCommand("SELECT ID_Pratica FROM Pratiche ORDER BY ID_Pratica ASC", oConn) Dim oRead As SqlDataReader = oComm.ExecuteReader While oRead.Read() Dim n1 As New MyNodes(oRead("ID_Pratica"), "Pratica ") n1.Text = n1.Label + " " + n1.ID TreeView1.Nodes.Add(n1) 'qui' il nodo figlio # finto # End While oConn.Close() TreeView1.EndUpdate() End Sub Public Class MyNodes : Inherits TreeNode Public ID, Label As String Public Sub New(ByVal _ID_ As String, ByVal Testo As String) ID = _ID_ Label = Testo End Sub Public Overrides Function ToString() As String Return ID + " " + Label End Function End Class |
![]() |
![]() |
![]() |
Strumenti | |
|
|
Tutti gli orari sono GMT +1. Ora sono le: 03:22.