I have a scenario where i have modules, each module has sections and each section has programs.
So, I am creating groups during runtime in my program based on modules.
GetModules()
For each module
ExBar1.Groups.Add(ModuleID) ExBar1.Groups(ModuleID).Text = ModuleName ExBar1.GroupSettings.Style = Infragistics.Win.UltraWinExplorerBar.GroupStyle.ControlContainer
GetSections() based on module
For each section
ContainerCntl = New Infragistics.Win.UltraWinExplorerBar.UltraExplorerBarContainerControl ContainerCntl = ExBar1.Groups(ModuleID).Container
In each ContainerCntl, I am adding a Tree by name TreeCntl
TreeCntl = New Infragistics.Win.UltraWinTree.UltraTree ContainerCntl.CreateControl() ContainerCntl.Controls.Add(TreeCntl)
GetPrograms() based on Sections
Within TreeCntl, I am adding UltraLabel and another SubTree where SubTree Actually loads Programs and label displays name of the section
So,
Try SubTreeLabel = New Infragistics.Win.Misc.UltraLabel ContainerCntl.CreateControl() ContainerCntl.Controls.Add(SubTreeLabel) 'TreeCntl.CreateControl() 'TreeCntl.Controls.Add(SubTreeLabel) SubTreeCntl = New Infragistics.Win.UltraWinTree.UltraTree ContainerCntl.CreateControl() ContainerCntl.Controls.Add(SubTreeCntl) 'TreeCntl.CreateControl() 'TreeCntl.Controls.Add(SubTreeCntl)
I have a problem over here, Do i need to Create Controls under ContainerCntl and add them or else create them under TreeCntl and Add them. If I do the second way, it is not displaying them but first one is working fine.
So, I commented out.
But my actual problem is this one.
I have a event handler declared
With TreeCntl AddHandler TreeCntl.MouseClick, AddressOf TreeCntl_MouseClick End With
When I click on the TreeCntl.MouseClick,for the first time it is hitting only once but afterwards it is hitting the TreeCntl.MouseClick event twice, it means once it reaches 'End Sub' again it goes over to the first line.
What I am doing in TreeCntl MouseClick event is,
Private Sub TreeCntl_MouseClick(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles TreeCntl.MouseClick Cursor.Current = Cursors.WaitCursor Dim TreeControl As Infragistics.Win.UltraWinTree.UltraTree = TryCast(sender, Infragistics.Win.UltraWinTree.UltraTree) Dim SelectedNode As Infragistics.Win.UltraWinTree.UltraTreeNode = TreeControl.GetNodeFromPoint(e.Location) If SelectedNode Is Nothing Then Exit Sub Else SelectedNode.Selected = True End If If SelectedNode.Key = "294" Then 'If JobFormCount = False Then Try Dim I294 As New WindowsApplication1.I294 I294.MdiParent = Me I294.ConnectionString = connstring I294.CompanyNumber = doco I294.CompanyName = oComp.databaseName I294.UserId = loginId I294.Show() Catch ex As Exception MessageBox.Show(ex.Message & vbCrLf & ex.ToString, " Cannot Run AR Daily Production Tracking Maintenance") End Try Else If e.Button = Windows.Forms.MouseButtons.Right Then Exit Sub 'Check for rightclick to get only context menu Dim SectionID As String = SelectedNode.Key Dim SectionName As String = SelectedNode.Text.Trim Dim ModuleID As String = SelectedNode.Tag.ToString ContainerCntl = ExBar1.Groups(ModuleID).Container GetModuleName(ModuleID) Dim ModuleName As String = dtModules.Rows(0).Item("ModuleName").ToString.Trim If ContainerCntl.Controls.Item(SectionName).Visible = False And ContainerCntl.Controls.Item(SectionName + "SubTreeCntl").Visible = False Then ContainerCntl.Controls.Item(SectionName).Show() ContainerCntl.Controls.Item(SectionName + "SubTreeCntl").Show() ContainerCntl.Controls.Item(SectionName).BringToFront() ContainerCntl.Controls.Item(SectionName + "SubTreeCntl").BringToFront() End If End If Cursor.Current = Cursors.Default End Sub
So, in the above code, the form code runs twice and it is opening twice.
Am I doing something wrong.
This is a sample picture of my explorer bar.
I'm not sure that I followed this but it sounds possible that you registered as a listener of the MouseClick event twice. This can be easily verified by placing a breakpoint on the line of code that calls AddHandler, and seeing if the breakpoint gets hit twice. The easiest solution if this turns out to be the problem is to call RemoveHandler prior to calling AddHandler.
Is infragistics going to release any new style of controls for the ultraexplorer bar. Right now It has Outlook, toolbox, visualstudio etc. I am looking for something which looks like visual studio toolbox or properties where it opens and closes and has a button when clicked, make it stay. Is anything like this going to be there in future releases??