|
-
Feb 23rd, 2005, 12:22 PM
#1
Thread Starter
New Member
[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
Last edited by WelcomeSinners; Feb 24th, 2005 at 11:43 AM.
-
Feb 23rd, 2005, 05:24 PM
#2
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?
Nobody knows what software they want until after you've delivered what they originally asked for.
Don't solve problems which don't exist.
"If I had eight hours to cut down a tree, I'd spend six hours sharpening my axe." --- Abraham Lincoln (1809-1865)
2 idiots don't make a genius.
-
Feb 24th, 2005, 03:10 AM
#3
Thread Starter
New Member
Re: ActiveX DLL and forms
I want the form to access methods of the class.
-
Feb 24th, 2005, 08:04 AM
#4
Lively Member
Re: ActiveX DLL and forms
 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
-
Feb 24th, 2005, 08:27 AM
#5
Thread Starter
New Member
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
Last edited by WelcomeSinners; Feb 24th, 2005 at 08:40 AM.
-
Feb 24th, 2005, 09:34 AM
#6
Re: ActiveX DLL and forms
Nobody knows what software they want until after you've delivered what they originally asked for.
Don't solve problems which don't exist.
"If I had eight hours to cut down a tree, I'd spend six hours sharpening my axe." --- Abraham Lincoln (1809-1865)
2 idiots don't make a genius.
-
Feb 24th, 2005, 11:43 AM
#7
Thread Starter
New Member
Re: ActiveX DLL and forms [RESOLVED]
Fantastic. Thanks for your help, much appreciated.
Cheers,
Simon
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
|