Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to "talk" with Form from class 1

Status
Not open for further replies.

Fudo

Programmer
May 9, 2000
6
US
Is its possible to talk with objects from class to form.
I am making program with "DLLs". Thanks
 
You should be able to manipulate objects on a form from within a class by prefixing the object name with the form name. I have done this many times before. If you use the auto complete stuff, all the objects available should be in that list.
 
Important information to my question:
I am talking about "EXE-Form" not Form in class.
Thanks
 

Quros is still right. You can also pass the form as a parameter.

Code this inside your class:
-----------------------------------------------------
Public sub ChangeFormCaption (TheForm as form)
TheForm.Caption = "Hello."
end sub
-----------------------------------------------------

And use it like this in your exe:
----------------------------------------------------
Mydll.ChangeFormCaption Me
----------------------------------------------------



Sunaj
'The gap between theory and practice is not as wide in theory as it is in practice'
 
It does not work with "EXE-Form" :-((((
(with dll-Form works).
 
Hmmm then you have to explain what you mean by 'EXE-form' - I've just tested a dll that plot a world map on a form in a vb project (.vbp or .exe).
The class looks like this:
-------------------------------------------------
Public Property Let PlotOnForm(TheForm)
Set PlotOn = TheForm
End Property
-------------------------------------------------

-and it works fine.

Sunaj
'The gap between theory and practice is not as wide in theory as it is in practice'
 
first thank you for your support :)
My project looks like this:
1) I have a projectGroup names FundResearch.vbg , this contain 2 projects
1.1 Fundus.vbp (with forms) and
1.2 FundVolumen.vbp (with class -> dll)
So, I would like to change settings from forms in fundus.vbp
Tanks
 
Hi,

Yes that is exactly like mine project.

Code like this in your class (FundVolumen)
-------------------------------------------------
Dim OpForm as form

Public Property Let ChangeOnForm(TheForm)
Set OpForm = TheForm
End Property

public sub ChangeCaption(Caption as string)
Set OpForm.Caption = Caption
end sub
-------------------------------------------------

And then in your vb project (Fundus):
--------------------------------------------------
Dim Test as new FundVolumen

FundVolumen.ChangeOnForm = Me 'Me is synonym for the current form
Fundvolumen.ChangeCaption("Er du dansk?")
--------------------------------------------------


Sunaj
'The gap between theory and practice is not as wide in theory as it is in practice'
 
Thank you sunaj
its works
I would kiss you if you were here :)
greetings form CH
 
You could give me a star instead....
Sunaj
'The gap between theory and practice is not as wide in theory as it is in practice'
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top