Referencing an instance of a webdialog

I have a webdialog that can be opened from several places within my webapp. This can open a second webdialog.

After changes have been made within the second, I’m trying to run a method on the first before closing the second. But I need to be able to reference the instance of the first.

Implement the dismissed event in the first instance for the second instance. Review

Hi Wayne, Thanks for your answer. I will use that in the future.

However I’m trying to run code on the first dialog from the second. The example you referred me to runs code within itself.

I do this all the time with webpages eg webpage.method

Hi Trevor, I had assumed that you wanted to run a method in the first instance then close the second? The dismissed event is run before closing the second dialog, and has access to all controls, properties & methods in that instance. You could pass the “me” object to a method in the first instance for processing.

Have you considered an interface for this?

No, I haven’t. I haven’t done anything using interface before. What would the advantages be?

So, can I assume there’s no way of referring to the code on the first while the second is closing?

The dismissed event is called by the second instance. You are referring to a method in the first instance. You can execute a method in the first instance passing properties etc. from the second instance.

If you wanted to execute a method in the parent object you would typically create an event in the child and handle that event in the parent.

I know this post is old but I’m still trying to be able to refer to an instance of a webdialogue. Anybody have any new ideas?

Very simple: use a Webdialog property. Instead of DIMming your WebDialog, do something like:

myPalette1 = New Palette1

Where myPalette1 is a property of your WebPage:

myPalette1 as Palette1

and Palette1 is the name of the WebDialog.

Then you can do something like