Solved

Altering form and control properties via dll

Posted on 2006-06-13
4
145 Views
Last Modified: 2010-04-30
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
0
Comment
Question by:born4code
  • 2
  • 2
4 Comments
 
LVL 13

Expert Comment

by:Mark_FreeSoftware
ID: 16898396

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
0
 
LVL 2

Author Comment

by:born4code
ID: 16898530
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

?
0
 
LVL 13

Accepted Solution

by:
Mark_FreeSoftware earned 500 total points
ID: 16898555

actually you can, but then use a public variable:

Dim outputlabel As Label

Private Sub Command1_Click()
   Set outputlabel = Label1
End Sub

Private Sub Command2_Click()
   outputlabel.Caption = "test"
End Sub


first press button one, (can be done in form load for example)

then press button 2,

the caption of label 1 is changing now.....
0
 
LVL 2

Author Comment

by:born4code
ID: 16899314
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
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

912 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now