[RESOLVED] ActiveX DLL and forms
How can I refer to properties and methods of the class I'm building from within the forms that I want to include in the DLL?.
e.g:
CLASS.CLS
VB Code:
private localvalue
public property get value()
value = localvalue
end property
public sub increasevalue()
localvalue = localvalue+1
end sub
FORM.FRM
VB Code:
sub command1_click()
if value() > 100 then
text1.text = value() ????
end if
end sub
I know that in this example I could refer to form.Text1 from the class, but my real life problem can't be solved that way.
Cheers,
Simon
Re: ActiveX DLL and forms
Do you want a Form to access methods of a Class, or do you want a Class to access methods from a Form?
Re: ActiveX DLL and forms
I want the form to access methods of the class.
Re: ActiveX DLL and forms
Quote:
Originally Posted by WelcomeSinners
I want the form to access methods of the class.
then you would need to initialize the class first in youre form code.
VB Code:
sub command1_click()
dim name as new class
if value() > 100 then
text1.text = name.value() ????
end if
set name = nothing
end sub
Re: ActiveX DLL and forms
> then you would need to initialize the class first in youre form code
VB Code:
sub command1_click()
dim name as new class
if value() > 100 then
text1.text = name.value() ????
end if
set name = nothing
end sub
Thanks for the response. Unfortunately, I don't want the form to access a new instance of the class, I want it to access the pre-existing class that the calling application has created, so it can act on and change the properties within it. Is this possible?
I've tried
in the header of the form, and:
VB Code:
Dim fForm as MyForm
set fForm = new MyForm
fForm.oClass = me
in the class module, and this compiles to a DLL. However when I call, from the main app., a class method that loads the form (which in turn tries to check one of the class properties), I get "Run-time error '91' - Object variable or With block variable not set".
Cheers,
Simon
Re: ActiveX DLL and forms
Re: ActiveX DLL and forms [RESOLVED]
Fantastic. Thanks for your help, much appreciated.
Cheers,
Simon