Event handler plz help me!!

i hav a VB.net class which allow to print a tree view ,i want to make the constractor handle an event sa follow :

Public Class PrintHelper

Private _printDoc As PrintDocument
Private _lastPrintPosition As Point

Public Sub PrintHelper() ' Constructor
_lastPrintPosition =
New Point(0, 0)
_printDoc =
New PrintDocument

' here i want to handle the next event
End Sub

'this is the event which i want to handle it above

Private Sub _printDoc_PrintPage(ByVal sender As Object, ByVal e As System.Drawing.Printing.PrintPageEventArgs)

_lastPrintPosition = New Point(0, 0)
_currentDir = PrintDirection.Horizontal
_pageNumber = 0
_date = DateTime.Now
.
.
.
End sub

'.
'.
'.

End Class




Answer this question

Event handler plz help me!!

  • Robert Barnes

    in VB the name of a contructor is always New (Public Sub New)

    I've never seen an event handled in a constructor before.



  • Event handler plz help me!!