late bound form reference

  • Thread starter Galen Somerville
  • Start date
G

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
 
H

Herfried K. Wagner [MVP]

Galen Somerville said:
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 = ...'
 
G

Galen Somerville

Herfried K. Wagner said:
Galen Somerville said:
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 = ...'

Sounds too simple (g)

GalenS
 
G

Galen Somerville

Galen Somerville said:
Herfried K. Wagner said:
Galen Somerville said:
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 = ...'

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top