Call a method of a container

I have a container that I embed with a DialogWindow. After I show the DialogWindow I want to call a method in the container. Is that possible?

Var dialog As New DialogWindow
Var tc As New JobsList
tc.EmbedWithin(dialog, 20, 20, 864,305)
dialog.ShowModal
txt_Status.Text = dialog.SelectedName

tc has a method called GetJobs(). how do I call that method? Is it posiible?

Thank you

Please use the code formatter button (</>) when pasting code. It makes it easier to read.

You have a reference to tc so you can call tc.GetJobs()
If you need to call GetJobs() later on, you will need to keep a reference to it.

Interesting find I assumed your suggestion and when I type tc. I expected the typical list of options that you can select from. In this particular case there are many. Mostly system options, however, the method I wanted was not one of them. This particular method returns a boolean.

So, following your advice I hard codded it expecting a not found error. I was surprised that it came back with the error you have to use the return value. then I tried this

If Not tc.

Now the list of options includes the method. I did not realize that the options returned is sensitive to the context you are typing. Makes sense but was not aware of the subtlety.

Thanks it works like a charm. Fyi call the method before showing the dialog.

1 Like

hiding existing methods is more annoying than usefully.
if you have methods without the need of the return value you can write Call tc. and all methods should appear.

for container controls direct placed on the window you could also use define event, raise event as alternative approach.

I’m not as familiar with defined events but Ill research that see if there are any advantages.