17/10/10 10:19
gvigliani
Ciao a tutti.
Ho un problemino che , come sempre , spero mi aiuterete a risolvere. Ho una TreeView con dei nodi e sottonodi ed un Panel che dovrebbe ricevere una informazione relativa al nodo cliccato e trasportato.
ho creato questa sub relativa alla treeview
Mentre queste altre 2 si riferiscono al Panel che riceve:
Il problema è che il codice mi comunica , tramite la msgbox(s) il testo relativo al nome del nodo e non il Node.Name che a me interessa.
Avete un modo per risolvere il mio problema?
Allego anche il codice che mi da' proprio questa informazione se clicco sul nodo interessato senza ovviamente il drag & Drop.
Ho un problemino che , come sempre , spero mi aiuterete a risolvere. Ho una TreeView con dei nodi e sottonodi ed un Panel che dovrebbe ricevere una informazione relativa al nodo cliccato e trasportato.
ho creato questa sub relativa alla treeview
Private Sub tvMarkets_DragEnter(ByVal sender As Object, ByVal e As System.Windows.Forms.DragEventArgs) Handles tvMarkets.DragEnter If e.Data.GetDataPresent(DataFormats.Text) Then e.Effect = DragDropEffects.Copy Else e.Effect = DragDropEffects.None End If End Sub
Mentre queste altre 2 si riferiscono al Panel che riceve:
Private Sub tbox_DragEnter(ByVal sender As Object, ByVal e As System.Windows.Forms.DragEventArgs) Handles tbox.DragEnter If e.Data.GetDataPresent(DataFormats.Text) Then e.Effect = DragDropEffects.Copy Else e.Effect = DragDropEffects.None End If End Sub Private Sub tbox_DragDrop(ByVal sender As Object, ByVal e As System.Windows.Forms.DragEventArgs) Handles tbox.DragDrop Dim dummy As String = "hello" Dim s As String = CStr(e.Data.GetData(dummy.GetType())) s = s.Substring((s.IndexOf(":") + 1)).Trim() Position.X = e.X Position.Y = e.Y Position = tbox.PointToClient(Position) MsgBox(s) End Sub
Il problema è che il codice mi comunica , tramite la msgbox(s) il testo relativo al nome del nodo e non il Node.Name che a me interessa.
Avete un modo per risolvere il mio problema?
Allego anche il codice che mi da' proprio questa informazione se clicco sul nodo interessato senza ovviamente il drag & Drop.
Private Sub tvMarkets_AfterSelect(ByVal sender As System.Object, ByVal e As System.Windows.Forms.TreeViewEventArgs) Handles tvMarkets.AfterSelect If e.Node.Nodes.Count = 0 Then Dim marketId As Integer = Val(e.Node.Name) 'This is the selected marketId End If End Sub
aaa