Results 1 to 2 of 2

Thread: Two quick questions...

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Feb 2002
    Posts
    85

    Two quick questions...

    As far as memory is concerned, is it better to use an OCX file, or the user control source directly within a project?

    Secondly, is there a way to ensure that the MouseOver event only fires once? I thought of creating a boolean and setting it to false when the mouse is moved off the control. Perhaps there's a better way?

    Thanks in advance,
    - Cam

  2. #2
    jim mcnamara
    Guest
    Creating a CLS module in the project uses less memory at run-time.

    If you're really worried about memory, VB is not the place to be.
    Even a UserControl in a a CLS module eats up multi-MB of memory.

    Use a Boolean and set it

    Code:
    Public skipme as Boolean
    
    Sub whatever_Event()
    if skipme=False  then
      'respond to the event one time
      skipme = True
    End if
    End Sub
    This stops the reponse to the event, not the firing of the event.
    To turn an event off you have to capture all the messages going to your form (called subclassing) and NOT pass along the one about MouseOver to the form. Intercept and stop it. This involves a several api calls. The above method is simpler.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width