Home All Groups Group Topic Archive Search About

late bound form reference

Author
4 Feb 2006 9:24 PM
Galen Somerville
In two different Form modules
FFTcls.Currfrm = Me


In FFTcls class module
Dim CurrForm As System.Windows.Forms.Form

Public WriteOnly Property Currfrm() As System.Windows.Forms.Form
  Set(ByVal Value As System.Windows.Forms.Form)
            CurrForm = Value
  End Set
End Property

In a sub in FFTcls module
        CType(CurrForm, Label).LabMsg.Caption = clsRes.LoadResStgA(210)


Error on last line is that currform does not contain label. I have tried
many different combinations within the Ctype(  )

The problem is I have eight labels in the Form module that may need
updating. I'm trying to avoid eight Property statements by using a late
bound thingy.

Also I don't want to make eight calls in the Form modules if only one label
has changes.


GalenS

Author
5 Feb 2006 2:24 AM
Herfried K. Wagner [MVP]
Show quote Hide quote
"Galen Somerville" <galen@SPAM.surewest.net> schrieb:
> In two different Form modules
> FFTcls.Currfrm = Me
>
>
> In FFTcls class module
> Dim CurrForm As System.Windows.Forms.Form
>
> Public WriteOnly Property Currfrm() As System.Windows.Forms.Form
>  Set(ByVal Value As System.Windows.Forms.Form)
>            CurrForm = Value
>  End Set
> End Property
>
> In a sub in FFTcls module
>        CType(CurrForm, Label).LabMsg.Caption = clsRes.LoadResStgA(210)
>[...]
> The problem is I have eight labels in the Form module that may need
> updating. I'm trying to avoid eight Property statements by using a late
> bound thingy.

Use 'CurrForm.LabMsg.Text = ...'

--
M S   Herfried K. Wagner
M V P  <URL:http://dotnet.mvps.org/>
V B   <URL:http://classicvb.org/petition/>
Author
5 Feb 2006 2:44 AM
Galen Somerville
Show quote Hide quote
"Herfried K. Wagner [MVP]" <hirf-spam-me-here@gmx.at> wrote in message
news:u67BStfKGHA.2392@TK2MSFTNGP09.phx.gbl...
> "Galen Somerville" <galen@SPAM.surewest.net> schrieb:
>> In two different Form modules
>> FFTcls.Currfrm = Me
>>
>>
>> In FFTcls class module
>> Dim CurrForm As System.Windows.Forms.Form
>>
>> Public WriteOnly Property Currfrm() As System.Windows.Forms.Form
>>  Set(ByVal Value As System.Windows.Forms.Form)
>>            CurrForm = Value
>>  End Set
>> End Property
>>
>> In a sub in FFTcls module
>>        CType(CurrForm, Label).LabMsg.Caption = clsRes.LoadResStgA(210)
>>[...]
>> The problem is I have eight labels in the Form module that may need
>> updating. I'm trying to avoid eight Property statements by using a late
>> bound thingy.
>
> Use 'CurrForm.LabMsg.Text = ...'
>
> --
> M S   Herfried K. Wagner
> M V P  <URL:http://dotnet.mvps.org/>
> V B   <URL:http://classicvb.org/petition/>

Sounds too simple (g)

GalenS
Author
5 Feb 2006 5:01 PM
Galen Somerville
Show quote Hide quote
"Galen Somerville" <galen@SPAM.surewest.net> wrote in message
news:%23Z6rX4fKGHA.604@TK2MSFTNGP14.phx.gbl...
>
> "Herfried K. Wagner [MVP]" <hirf-spam-me-here@gmx.at> wrote in message
> news:u67BStfKGHA.2392@TK2MSFTNGP09.phx.gbl...
>> "Galen Somerville" <galen@SPAM.surewest.net> schrieb:
>>> In two different Form modules
>>> FFTcls.Currfrm = Me
>>>
>>>
>>> In FFTcls class module
>>> Dim CurrForm As System.Windows.Forms.Form
>>>
>>> Public WriteOnly Property Currfrm() As System.Windows.Forms.Form
>>>  Set(ByVal Value As System.Windows.Forms.Form)
>>>            CurrForm = Value
>>>  End Set
>>> End Property
>>>
>>> In a sub in FFTcls module
>>>        CType(CurrForm, Label).LabMsg.Caption = clsRes.LoadResStgA(210)
>>>[...]
>>> The problem is I have eight labels in the Form module that may need
>>> updating. I'm trying to avoid eight Property statements by using a late
>>> bound thingy.
>>
>> Use 'CurrForm.LabMsg.Text = ...'
>>
>> --
>> M S   Herfried K. Wagner
>> M V P  <URL:http://dotnet.mvps.org/>
>> V B   <URL:http://classicvb.org/petition/>
>
> Sounds too simple (g)
>
> GalenS
>
>
I spoke too soon. Apparently there is no way to accomplish what I want.

I have several, but vastly different, forms all containing the same 8
Labels. They also have a picture box which I draw on. But the picturebox
calls the class with the direct name.

Whereas I am trying to write to the form labels with only the name of the
form available. This makes my writing to labels as Generic. It looks like I
will have to have a class property for each label so the class knows label
names.

Then, in the class, I will have to check the form name (or whatever) and
have If's or Case statements to write to the proper label on the proper
form.

Any other ideas?

GalenS