The ControlByPath function makes a reference to a control over a path specification.
Syntax | ||||
ControlByPath(Path, [PathDelimiter]) | ||||
Return value | ||||
Type |
Description | |||
Control |
The Control achieved via the path or NoValue | |||
Parameter | ||||
Use |
Name |
Type |
Passing |
Description |
Required |
Path |
String |
ByVal |
Path to the control built by the names of the parent controls. |
Optional |
PathDelimiter |
String |
ByVal |
The divider character in the path. Default value is “/”. |
Example:
Suppose there is a SubForm1 subform element on a form named F1 that displays a form from another object that contains a button named Button1. You now want to reference the Control object "Button1":
Dim c As Control
c := F1.ControlByPath("F1/SubFormular1/Button1")
If the PathDelimiter "/" exists in the names of a control, you can also specify another PathDelimiter:
Dim c As Control
c := F1.ControlByPath("F1%SubFormular1%Button1", "%")