Results 1 to 6 of 6

Thread: Problems with forms.......help....help.......

  1. #1

    Thread Starter
    Member
    Join Date
    Jul 2000
    Location
    Singapore
    Posts
    32

    Wink

    I have a form called Form1. This form can be called by either FormA or FormB. Are there any ways whereby Form1 will know which one of these forms has called it?? If possible i do not want to use any MDI forms.

  2. #2
    Addicted Member LAURENS's Avatar
    Join Date
    Jan 2000
    Location
    Utrecht, the Netherlands
    Posts
    138
    As far as I know there isn't.
    You can create one yourself eg. by introducing a 'parent' in the form that you fill with a value by which it will 'know' by whom it is called.
    Regards,
    Laurens

    Using VB5 Enterprise edition SP3
    VB6 Enterprise edition SP5

  3. #3

    Thread Starter
    Member
    Join Date
    Jul 2000
    Location
    Singapore
    Posts
    32
    how can that be done???

  4. #4
    Addicted Member LAURENS's Avatar
    Join Date
    Jan 2000
    Location
    Utrecht, the Netherlands
    Posts
    138
    Put a commandbutton on Form1
    Paste this code into the general section of Form1.
    Code:
    Option Explicit
    Public intCalledBy As Integer 'Consider this your new property. 
    'You could also make it private and use get and let property statements. 
    ' But that's exactly what VB will do under water when you use a public.
    
    Private Sub Command1_Click()
    
       Select Case intCalledBy
       
          Case 1
             MsgBox "Called by FormA"
          Case 2
             MsgBox "Called by FormB"
          
       End Select
    
    End Sub
    Put a commandbutton on FormA.
    Paste this code into the general section of FormA.
    Code:
    Private Sub Command1_Click()
    Dim frmForm As Form
    
       Set frmForm = New Form1
       frmForm.intCalledBy = 1
       frmForm.Show vbModal
       Set frmForm = Nothing
       
    End Sub
    Make sure you have FormA as startup Form.
    Is this what you mean?

    Regards,
    Laurens

    Using VB5 Enterprise edition SP3
    VB6 Enterprise edition SP5

  5. #5
    Lively Member
    Join Date
    Nov 2000
    Posts
    73
    hi,
    try this way in formA where u are calling form1
    load form1
    form1.tag = me.name / form1.tag = formA.name
    and access form1 properties


  6. #6

    Thread Starter
    Member
    Join Date
    Jul 2000
    Location
    Singapore
    Posts
    32

    Talking

    thanks a million laurens and krigans for the help..... i'll experiment with both codes.

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