In VB.NET, I can programmatically call a button press by typing something along these lines: CloseCommButton_Click(sender, e)Now, I have a separate function that handles button clicks:
Private Sub UltraToolbarsManager1_ToolClick(sender As Object, e As Infragistics.Win.UltraWinToolbars.ToolClickEventArgs) Handles UltraToolbarsManager1.ToolClick
Case "CloseCommButton" HandleOpenCommButton()
End Select
I would like to create a function that will pass "CloseCommButton" to the UltraToolbarsManager1_ToolClick function but in order to do this, I need to provide it with an objects and a toolclickeventargs. Since I'm calling it from a function, I don't know what to send it. I've tried something along the lines of:
dim sender as object
dim e as toolclickevents
Dim e As Infragistics.Win.UltraWinToolbars.ToolClickEventArgs = "CloseCommButton"
UltraToolbarsManager1_ToolClick(sender,e)
But this isn't working as I am being told that a string cannot be converted to Infragistics.Win.UltraWinToolbars.ToolClickEventArgs. I'm stuck as to how to proceed from here and can't see to find another topic that discusses how to do this. If you can help me with this, I'd appreciate it. Thanks!
Thanks for the reply, I ended up doing something along those lines when I gave up trying to force a square peg into a round hole. Thanks for the response!
Hi Jeremy,
You don't have to programatically call the button's click event handler. Just move the event handler's method body in a new method and call that instead. So when the toolbar button is clicked you can call the same method as it is called from the button's click event handler.
When you are designing your toolbar you set the Key property on them. That property you have too check in the toolbarsManager_ToolClick event handler: e.Tool.Key.
HTH,
Emanuel