From: Phil Hunt on
When formX do a formY.Show vbModeless, Me, does formY know the reference of
Me (where it originate).
I am trying to show the original form and I don't want to use vbModel. If
not, any sugestion is welcome.

Thanks


From: ralph on
On Mon, 12 Apr 2010 13:35:54 -0400, "Phil Hunt" <aaa(a)aaa.com> wrote:

>When formX do a formY.Show vbModeless, Me, does formY know the reference of
>Me (where it originate).
>I am trying to show the original form and I don't want to use vbModel. If
>not, any sugestion is welcome.
>

If I understand your question then yes. "Me" is an auto self-reference
thus dependent on the context (or Scope) of where it is called.

In this case if called from FormX it refers to FormX.

-ralph
From: Bob Butler on

"ralph" <nt_consulting64(a)yahoo.net> wrote in message
news:2tm6s5hnh1t8erm4skpb65gi7j9ugb4crq(a)4ax.com...
> On Mon, 12 Apr 2010 13:35:54 -0400, "Phil Hunt" <aaa(a)aaa.com> wrote:
>
>>When formX do a formY.Show vbModeless, Me, does formY know the reference
>>of
>>Me (where it originate).
>>I am trying to show the original form and I don't want to use vbModel. If
>>not, any sugestion is welcome.
>>
>
> If I understand your question then yes. "Me" is an auto self-reference
> thus dependent on the context (or Scope) of where it is called.
>
> In this case if called from FormX it refers to FormX.

The question was if 'FormY' knows so the answer is no. You can use API
calls to determine the form's owner and then mtch that to the possible forms
but the simplest option is to do something like this in FormY:

Private mfOwner As Form

Public Sub ShowSelf(byval TheOwner As Form)
Set mfOwner=TheOwner
Me.Show vbModeless, TheOwner
End Sub

and in calling forms:

FormY.ShowSelf Me

You should be sure to have FormY "Set mfOwner=Nothing" when no longer needed
to release the reference.

From: Phil Hunt on
ding ding ding. You may go on to the next round.
Thanks, I will check out the API.


"Bob Butler" <noway(a)nospam.ever> wrote in message
news:e52SMnm2KHA.4336(a)TK2MSFTNGP04.phx.gbl...
>
> "ralph" <nt_consulting64(a)yahoo.net> wrote in message
> news:2tm6s5hnh1t8erm4skpb65gi7j9ugb4crq(a)4ax.com...
>> On Mon, 12 Apr 2010 13:35:54 -0400, "Phil Hunt" <aaa(a)aaa.com> wrote:
>>
>>>When formX do a formY.Show vbModeless, Me, does formY know the reference
>>>of
>>>Me (where it originate).
>>>I am trying to show the original form and I don't want to use vbModel. If
>>>not, any sugestion is welcome.
>>>
>>
>> If I understand your question then yes. "Me" is an auto self-reference
>> thus dependent on the context (or Scope) of where it is called.
>>
>> In this case if called from FormX it refers to FormX.
>
> The question was if 'FormY' knows so the answer is no. You can use API
> calls to determine the form's owner and then mtch that to the possible
> forms but the simplest option is to do something like this in FormY:
>
> Private mfOwner As Form
>
> Public Sub ShowSelf(byval TheOwner As Form)
> Set mfOwner=TheOwner
> Me.Show vbModeless, TheOwner
> End Sub
>
> and in calling forms:
>
> FormY.ShowSelf Me
>
> You should be sure to have FormY "Set mfOwner=Nothing" when no longer
> needed to release the reference.
>


From: Larry Serflaten on

"Phil Hunt" <aaa(a)aaa.com> wrote
> When formX do a formY.Show vbModeless, Me, does formY know the reference of
> Me (where it originate).
> I am trying to show the original form and I don't want to use vbModel. If
> not, any sugestion is welcome.


I'm not sure if this will suit your needs, but you could give FormY a new
ShowForm routine that allows you to pass in a reference:

'[ In FormY ]
Public Sub ShowForm(ByVal Style As FormShowConstants, Optional Owner As Form)
If Not IsMissing(Owner) Then
Set mOwner = Owner
Me.Show Style, Owner
Else
Set mOwner = Me
Me.Show Style
End If
End Sub


Where mOwner is a form level variable you can use to show the calling form.

Then instead of using: FormY.Show vbModeless, Me
Use: FormY.ShowForm vbModeless, Me

HTH
LFS


 |  Next  |  Last
Pages: 1 2
Prev: Transparent image dragging
Next: formattting numbers