change containercontrol value from another window

i want to change containercontrol value (label.text value) from another window. how can i achieve that?

i have attached a demo project ->

You need to reference the embedded control:

myWindow.EmbeddedControl1.label1.Text = “Some New Text”

https://imgur.com/EnyyllM

frm_pruebas.ContainerControl11.lbl_texto.Text = "Hello"

that code does not work on both ContainerControl11 and ContainerControl12

i want the same code works for both buttons

frm_pruebas.ContainerControl11.lbl_texto.Text = "Hello1" frm_pruebas.ContainerControl12.lbl_texto.Text = "Hello2"

:slight_smile: …sorry if I’m not explaining myself well. my english is far from perfect. ideally i would like the secondary window (frm_secundario) to be embedded inside the containercontrol. maybe that’s not possible, but maybe there’s another way.
something like self.ContainerControl1.lbl_text.Text = “Hello”… but that actually works

[quote]frm_pruebas.ContainerControl11.lbl_texto.Text = "Hello1" frm_pruebas.ContainerControl12.lbl_texto.Text = "Hello2"[/quote]

i want the same text (Hello1) in both cases

please Julian dont write

frm_pruebas.ContainerControl11.lbl_texto.Text = "Hello1" frm_pruebas.ContainerControl12.lbl_texto.Text = "Hello1"

:slight_smile:

frm_pruebas.ContainerControl11.lbl_texto.Text = "Hello1" frm_pruebas.ContainerControl12.lbl_texto.Text = frm_pruebas.ContainerControl11.lbl_texto.Text

If you explain what you’re trying to do we might be able to work out a better solution.

That is because embedded container instance 12 is not the same as embedded container instance 11.

This means that the lbl_texto label is not the same control instance on the two containers. You must set the value for each embedded instance of the container’s contents.

Oh yes - and you can’t manipulate the actual container’s contents in this manner - you MUST reference the embedded instances.

my final goal is to make an account finder. as i have to use it in many forms, i want to create a totally independent class (containercontrol) that displays a listbox in an additional window. when i select the desired account, i simply want to show the account data in the containercontrol. the reason i don’t want the listbox inside the containercontrol is because it would take up a lot of space in the interface and would generate overlapping controls.

Translated with www.DeepL.com/Translator

Hi Nicolas,

if I understood well, why not declaring a Method in your ContainerControl subclass receiving the data you want to display in the container controls? So, after querying the database (or any other data source; as for example arbitrary selections made in another Window) you just need to call your MyContainerControlInstance.MyUpdateDataMethod( newValue)

Of course “NewValue” needs to be any collection type, so you can identify later the values associated with a particular control in your ContainerControl.

Then, inside that method you can refer any Control in the ConttainerControl subclass to update them with the expected values.

Is something like that what you want to achieve?

Javier

This is a mechanism that I use. I pass in a dictionary of values set like this:

theDictionary.Value("lbl_texto") = "The New Text"
And in the receiving method, I use:

If thePassedDictionary.HasKey("lbl_texto") Then lbl_texto.Text = thePassedDictionary.Value("lbl_texto").StringValue End IF

yes, exactly that! works like a charm… thanks javier.

thanks a lot tim and julian!