Results 1 to 4 of 4

Thread: Very general question - communication between forms

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Mar 2001
    Posts
    152

    Very general question - communication between forms

    Is it possible for one form to call a function that resides on another form or do I need to create module with a Public function? I know this is fundamental, but I can't seem to find anything related to this.

    Thanks.

  2. #2
    Frenzied Member Jmacp's Avatar
    Join Date
    Jul 2003
    Location
    UK
    Posts
    1,959

    Re: Very general question - communication between forms

    if you make the function public in the form you can call from, say form1,

    form2.myfunction

  3. #3
    Fanatic Member cid's Avatar
    Join Date
    Nov 2002
    Location
    Fort Worth, Texas
    Posts
    854

    Re: Very general question - communication between forms

    its possible...

    say form1 wants to call a command button procedure on form 2

    so it would be like this...
    VB Code:
    1. 'command button on form 1
    2. Public Sub Command1_Click
    3. Form2.Command2_Click 'Command button on form 2 that you want to call.
    4. End Sub

    www.google.com - Pay Tribute.

    Always Listening To: Thrice

  4. #4
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: Very general question - communication between forms

    If you make the sub Public on your form, then it can be called from another form by explicitly referring to the form the sub is on.
    VB Code:
    1. 'example
    2. 'On form1
    3. Public Sub DoSomething()
    4. 'cool code
    5. End Sub
    6.  
    7. 'on Form2
    8. Private Sub cmdDoSomething_Click()
    9. Form1.DoSomething
    10. End Sub

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