There is a listbox in ContainerControl A, and when I try to populate the listbox after modifying several data within the same ContainerControl, the Listbox shows the updated data correctly.
However, in case I do the same thing but in other global module, the listbox doesn’t show the updated data.
In Global module, I coded like below.
Dim repConfigCon As New RepConfigurationContainer
repConfigCon.DisplayRepConfig 'populates listbox for the updated data
Something wrong in my approach?
Thanks in advance,
Yes, your approach is wrong.
You don’t need to define the container control as a new control since you’re trying to access the one that already exists on the window. You can access the container control directly each time, or define it as a variable for ease.
[code]// myContainerControl is the container control in your navigator
// myContainerControlInstance is the instance of the control that is on your window (named myWindow here)
dim containerShortcut as myContainerControl = myWindow.myContainerControlInstance
// you can then use containerShortcut to update your listbox
From what you provided, it looks like your container control has a method that populates the listbox. This means you don’t necessarily have to define a variable to access the container control, you can just access the container control method with one line.
tl;dr - The way to access a ContainerControl is to use it’s actual instance on the window.
Oh.really. It works well now.
Thanks for your clear explanation!