DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Thread: Declare statements

  1. #1
    Mark Guest

    Declare statements


    Hi,

    I read in the MSDN about how to put event handlers for DTS packages. Here
    is a sample.

    --Beginning of code
    Private Sub oPackage_OnError(ByVal EventSource As String, _
    ByVal ErrorCode As Long, _
    ByVal Source As String, _
    ByVal Description As String, _
    ByVal HelpFile As String, _
    ByVal HelpContext As Long, _
    ByVal IDofInterfaceWithError As String, _
    ByRef pbCancel As Boolean)
    Debug.Print "oPackage_OnError Fired"
    End Sub


    --end of code

    It state that I need to declare it and implement it in order for it to work.
    What does it mean? The only thing I can think of is using

    declare sub OnError lib "kernal32" (ByVal EventSource As String, _
    ByVal ErrorCode As Long, _
    ByVal Source As String, _
    ByVal Description As String, _
    ByVal HelpFile As String, _
    ByVal HelpContext As Long, _
    ByVal IDofInterfaceWithError As String, _
    ByRef pbCancel As Boolean)

    something like that. Is this correct or what does it mean. Million thanks.

    Mark


  2. #2
    Steve Berzins Guest

    Re: Declare statements

    I think it means you need to declare the object 'WithEvents'

    you need to set a reference in your project to DTS and declare the variable
    in a form or a class WithEvents, then write code in the event procedure and
    your on your way.

    much like putting a button on a form, just that objects declared like this
    are
    without the visual representation...
    the withevents keyword tells VB to hook it all up for you and it just works.

    Private WithEvents oPackage As DTS.Package

    then you can select oPackage from the left drop down, and the event you
    want to 'hook' from the right drop down, put code in it and your on your
    way.

    make sense?

    Steve
    Private WithEvents oPackage As DTS.Package or whatever the class is
    "Mark" <mthead28@hotmail.com> wrote in message
    news:3b6977de@news.devx.com...
    >
    > Hi,
    >
    > I read in the MSDN about how to put event handlers for DTS packages. Here
    > is a sample.
    >
    > --Beginning of code
    > Private Sub oPackage_OnError(ByVal EventSource As String, _
    > ByVal ErrorCode As Long, _
    > ByVal Source As String, _
    > ByVal Description As String, _
    > ByVal HelpFile As String, _
    > ByVal HelpContext As Long, _
    > ByVal IDofInterfaceWithError As String, _
    > ByRef pbCancel As Boolean)
    > Debug.Print "oPackage_OnError Fired"
    > End Sub
    >
    >
    > --end of code
    >
    > It state that I need to declare it and implement it in order for it to

    work.
    > What does it mean? The only thing I can think of is using
    >
    > declare sub OnError lib "kernal32" (ByVal EventSource As String, _
    > ByVal ErrorCode As Long, _
    > ByVal Source As String, _
    > ByVal Description As String, _
    > ByVal HelpFile As String, _
    > ByVal HelpContext As Long, _
    > ByVal IDofInterfaceWithError As String, _
    > ByRef pbCancel As Boolean)
    >
    > something like that. Is this correct or what does it mean. Million

    thanks.
    >
    > Mark
    >




Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center