Change example for Visual Basic

Note: Also works with Access 95 and 97.

Typically, you would use this event to flag changed image data and prompt the user to save the changes before closing a window or exiting an application. That use of the event cannot be tested properly without writing a complete application; so this example just shows you a simple test of the event.

This example is for an ILEADRaster Object created at run-time.

'Declare an ILEADRaster Object WithEvents
Public WithEvents MyRaster As LEADRaster

Private Sub Command1_Click()
    'Create a new ILEADRaster Object
    Dim Factory As New LEADRasterFactory
    Dim szLic As String
    
    'Create the object
    szLic = "LEADTOOLS OCX Copyright (c) 1991-2005 LEAD Technologies, Inc." & vbCrLf & vbCrLf
    Set MyRaster = Factory.CreateObject("LEADRaster.LEADRaster", szLic)
    
    'create a new bitmap
    MyRaster.ScaleMode = SCALEMODE_PIXEL
    MyRaster.CreateBitmap 100, 100, 24 'this will fire the Change event
End Sub


Private Sub MyRaster_Change(ByVal nChange As Long, ByVal nReserved1 As Long, ByVal nReserved2 As Long)
    MsgBox "Image data changed: " & CStr(nChange)
End Sub