When my form first loads I would like to fire this event without a mouse click. How would I do that.
When you handle the ItemClick event VB generates a method to handle the event, like this:
Private Sub ultraExplorerBar1_ItemClick(ByVal sender As Object, ByVal e As ItemEventArgs) Handles ultraExplorerBar1.ItemClick
End Sub
You can call this directly by creating an instance of the ItemEventArgs class and passing it to that method, like this:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim someItem As UltraExplorerBarItem = Me.ultraExplorerBar1.Groups(0).Items(0) Dim eventArgs As New ItemEventArgs(someItem) Me.ultraExplorerBar1_ItemClick(Me.ultraExplorerBar1, eventArgs) End Sub
Thus simulating a firing of the event.
Brian;
Thanks for the input. Would it be possible to explain it in a way that a slightly less experienced person would understand.
Thanks
There is no way to actually trigger the event short of deriving a class from the control and calling the protected OnItemClick method. However, you can call the event handler directly, since the ItemEventArgs class exposes a public constructor. That would cause the same code to get executed as when the control's event is fired.