Results 1 to 3 of 3

Thread: Calling a Form Procedure from a Module ... :confused:

  1. #1

    Thread Starter
    New Member
    Join Date
    Apr 2000
    Posts
    1

    Calling a Form Procedure from a Module ...

    is it possible?

    Example: I want to call from my general module, a procedure in my Form1 from Image1_Click() ... If it's possible to do that, just tell me how please!

    Another Question: From an Image array, is it possible for each of them to have a procedure like:

    Image(0)_Click()
    Image(1)_Click()
    etc...

    If so, how ?

    Thanx!!


    [Edited by Lady Tatjahna on 04-01-2000 at 09:13 PM]
    -=-=-= Lady Tatjahna =-=-=-

  2. #2
    Lively Member
    Join Date
    Mar 2000
    Posts
    82
    I think that all events on a control are private and unable to be called from outside that form. If this is the case you can put a public function in your form mod:
    public sub GetClick(), call that function from your module:
    form1.GetClick, and have GetClick call the image1_Click().
    Hope that makes sense, I started to lose myself.

    As far as Image(0)_click, Image(1)_click: I tried and vb6 wouldn't let me create sep. events for each image. Just use a select case inside the Image_click(index as int)

  3. #3
    Addicted Member jcouture100's Avatar
    Join Date
    Aug 1999
    Posts
    141
    This is actually pretty easy to do. Just make sure that your routine on your form is declared as Public.

    Code:
    Public Sub Command1_Click()
        MsgBox "Button Clicked"
    End Sub
    Once you do that, the rest of your program can use the Sub and call it like any other Sub or Function...

    Call FormName.Command1_Click

    For your next question, You will just have the one click event for the object example you gave, but you can use a Select Case statement to get the result you want ...

    Code:
    Select Case Index
        Case 0
            'Enter code for Image(0) event here.
        Case 1
            'Enter code for Image(1) event here.
    
    End Select
    Hope this helps.

    JC

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