AdvancedHMI Software
General Category => Support Questions => Topic started by: Phrog30 on July 21, 2017, 09:15:58 PM
-
I'm creating an audit system which logs several things to a DB. I would like to grab the component name as well as form name the component is on. Example, when a basicbutton is pressed I will log the user, datetime, and the button name and the form the button is on. I have figured out everything but the form name. The issue is the audit event is in the controls solution (basicbutton code) so when I try to find the form with the component is comes back as nothing. Is it possible to cross solutions and find a form searching a control? It's easy to go from AdvancedHMI solution to AdvancedHMIControls solution, but not the other way around. Any guidance is much appreciated.
James
-
Would something like this do it:
Dim pf As Control
'* Keep going up the tree until we find the top level parent
pf = Parent
While (pf IsNot Nothing) AndAlso (Not (TypeOf (pf) Is Form))
If pf.Parent IsNot Nothing Then
pf = pf.Parent
Else
Exit While
End If
End While
MsgBox(DirectCast(pf, Form).Name)
-
Yes sir, that works like a champ. Thanks...
-
I dare the end user to say, "No, we didn't hit that button!!".... :)
-
Is there anyway that when an event occurs in the controls solution that I could somehow trigger an event in the advancedhmi solution?
-
Is there anyway that when an event occurs in the controls solution that I could somehow trigger an event in the advancedhmi solution?
Do you mean an existing event, such as the Click event of a BasicButton, or an event that doesn't exist, such as a value changing of a custom property.
-
Either, but as an example if on a click event how could I "send" this across to the HMI solution and then pick this up. Its easy from HMI to controls, but not the other way.