Print Page | Close Window

command bar FindControl keeps returning the same

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Command Bars
Forum Description: Topics Related to Codejock Command Bars
URL: http://forum.codejock.com/forum_posts.asp?TID=23774
Printed Date: 23 November 2024 at 10:14am
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: command bar FindControl keeps returning the same
Posted By: paulhaggo
Subject: command bar FindControl keeps returning the same
Date Posted: 03 December 2018 at 5:04am
Hello

I am trying to loop the menu to find captions of sub menu items

I did email support 4 days ago, no answer Yet again, the extra paid support is awful

The basic idea here, is a function, which i supply a button id and it puts the child button captions in a listbox

I know the code works because If i use it once, it works.. and if i close the exe and try a different button, it returns the new correct buttons values

However, if I press around the buttons without restarting the exe, i always get the same data back

So it appears to be caching, does anyone know how to clear the find function, the nothing vb method do not seem to work

My code is below, thank you

Public Sub FillReportsListBox(strParentButtonName As String)

Dim cbcTemp As CommandBarControl
   
Set cbcTemp = frmMain.CJMenuPopUp.FindControl(xtpControlButton, strParentButtonName, True, False)

Debug.Print cbcTemp.ID
lvwReports.ClearList

    Dim intx As Integer
        intx = 1
    Dim lngItem As Long
    
    While (intx < cbcTemp.Controls.Count)
        
           lngItem = lvwReports.AddItem(cbcTemp.Controls(intx).Caption)
   
        intx = intx + 1
    Wend

Set cbcTemp = Nothing

End Sub





Replies:
Posted By: paulhaggo
Date Posted: 05 December 2018 at 5:10am
I got this working in the end, incase anyone ever needs it


vb6 

CJMenuPopUp = name of my CommandBars object
ID_REPORTS_CLIENTS = a long (name happened to match the button ID, its a long which equals the ID in the button xml > designed > export xml)

Public Sub FillReportsListBox()

Dim cbcTemp As CommandBarControl

Set cbcTemp = frmMain.CJMenuPopUp.FindControl(xtpControlPopup, ID_REPORTS_CLIENTS, True, True)

Dim intx As Integer
    intx = 1

While (intx < cbcTemp.CommandBar.Controls.Count)
  
   Debug.Print cbcTemp.CommandBar.Controls(intx).Caption
   intx = intx + 1

Wend
 



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net