T
Ty
I have a class that I have created that inherits the Treeview. It
handles and raises an event. The event fires but the sub for the form
never sees the event.
Here is my code.
CLASS
Imports System.IO
Public Class DirectoryTreeview
Inherits TreeView
Public Event DirectorySelected(ByVal sender As Object, ByVal e As
DirectorySelectedEventArgs)
Private _Drive As Char
Protected Overrides Sub OnAfterSelect(ByVal e As
TreeViewEventArgs)
MyBase.OnAfterSelect(e)
RaiseEvent DirectorySelected(Me, New DirectorySelectedEventArgs
(e.Node.FullPath))
End Sub
End Class
Public Class DirectorySelectedEventArgs
Inherits EventArgs
Public DirectoryName As String
Public Sub New(ByVal DirectoryName As String)
Me.DirectoryName = DirectoryName
End Sub
End Class
VB FORM CODE
Public WithEvents dtEvent As DirectoryTreeview
SUB TO HANDEL EVENT
Private Sub GetFiles(ByVal sender As Object, ByVal e As
DirectorySelectedEventArgs) 'Handles dtEvent.DirectorySelected
Msgbox("Event Fired")
End Sub
Any help with why this is not working would be appreciated.
Ty
handles and raises an event. The event fires but the sub for the form
never sees the event.
Here is my code.
CLASS
Imports System.IO
Public Class DirectoryTreeview
Inherits TreeView
Public Event DirectorySelected(ByVal sender As Object, ByVal e As
DirectorySelectedEventArgs)
Private _Drive As Char
Protected Overrides Sub OnAfterSelect(ByVal e As
TreeViewEventArgs)
MyBase.OnAfterSelect(e)
RaiseEvent DirectorySelected(Me, New DirectorySelectedEventArgs
(e.Node.FullPath))
End Sub
End Class
Public Class DirectorySelectedEventArgs
Inherits EventArgs
Public DirectoryName As String
Public Sub New(ByVal DirectoryName As String)
Me.DirectoryName = DirectoryName
End Sub
End Class
VB FORM CODE
Public WithEvents dtEvent As DirectoryTreeview
SUB TO HANDEL EVENT
Private Sub GetFiles(ByVal sender As Object, ByVal e As
DirectorySelectedEventArgs) 'Handles dtEvent.DirectorySelected
Msgbox("Event Fired")
End Sub
Any help with why this is not working would be appreciated.
Ty