Link to home
Start Free TrialLog in
Avatar of born4code
born4code

asked on

Altering form and control properties via dll

Does anyone have any best practice, as it pertains to altering a form control property from a referenced dll?

For example, if I have a dll that gets called and is running a process... and I want a label in the calling form to say "please wait, processing" (caption property)...

But I do not want to change any code on the form... just do it from the dll class file.

Thanks
Avatar of Mark_FreeSoftware
Mark_FreeSoftware
Flag of Netherlands image


you can try somthing like this:

in your dll:

Public Sub update(lbl As Label, yourstuff As Variant)
   lbl.Caption = "Loading, please wait!"
End Sub



in your app:

Private Sub Command1_Click()
   update Label1, "your data and other things here"
End Sub
Avatar of born4code
born4code

ASKER

Yes, but if I am handling events then I don't have the luxury of passing the control variable.  That would be the obvious choice.  I am using a control handler... let say in the class I have...

Public Sub cmdUpdate_Click()  '<<<< handles the click event, no params passed
'something here
End Sub

?
ASKER CERTIFIED SOLUTION
Avatar of Mark_FreeSoftware
Mark_FreeSoftware
Flag of Netherlands image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Ah... okay, what I did was put the declaration right inside of my Class file, and then set it in the form load of the page.  Then I can access it directory from the class.  Duh!

Works good this way.  The only thing that stinks is that it sure would be nice to pull it somewhere from an object elsewhere... I did experiment with VB.Forms object... and if I use the form name I can trace it down that way as well.


Thanks