command bar FindControl keeps returning the same |
Post Reply |
Author | |
paulhaggo
Groupie Joined: 21 June 2018 Status: Offline Points: 19 |
Post Options
Thanks(0)
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 |
|
paulhaggo
Groupie Joined: 21 June 2018 Status: Offline Points: 19 |
Post Options
Thanks(0)
|
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 |
|
Post Reply | |
Tweet
|
Forum Jump | Forum Permissions You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |