I have an 'afterselect' event for a treeview.
$tv_AfterSelect=[System.Windows.Forms.TreeViewEventHandler]{
..bunch of code
}
I want to invoke this event also from a button to refresh the tree, but I don't know how to exactly do that..
$tv_AfterSelect.Invoke($sender, $e)
What do I provide as the sender ($sender) and treelistarguments ($e) ?
Rob
Invoking TreelistView events
Forum rules
Do not post any licensing information in this forum.
Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
Do not post any licensing information in this forum.
Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
- robert.ganshorn
- Posts: 54
- Last visit: Sat Nov 25, 2023 8:17 pm
Re: Invoking TreelistView events
Unfortunately this won't work because the event is expecting arguments passed to it. It throws an error on the invoke.
I worked around this by having the event just call a new function and pass treeview node name value. The other button event can do the same by just getting the current selected node name and passing that to the new function as well.
Events without the "=[System.Windows.Forms.TreeViewEventHandler]" can be invoked as you state.
Rob
I worked around this by having the event just call a new function and pass treeview node name value. The other button event can do the same by just getting the current selected node name and passing that to the new function as well.
Events without the "=[System.Windows.Forms.TreeViewEventHandler]" can be invoked as you state.
Rob