|
-
Nov 23rd, 2000, 03:48 AM
#1
Thread Starter
Member
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.
-
Nov 23rd, 2000, 04:01 AM
#2
Addicted Member
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
-
Nov 23rd, 2000, 04:04 AM
#3
Thread Starter
Member
-
Nov 23rd, 2000, 04:19 AM
#4
Addicted Member
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
-
Nov 23rd, 2000, 04:22 AM
#5
Lively Member
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
-
Nov 23rd, 2000, 04:26 AM
#6
Thread Starter
Member
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|