Return Window Property to ContainerControl TextField

Hi,

I created a ContainerControl with a Textfield and a Button. If the Button is clicked, Window2 will show. Window2 has also a Textfield and a Button. After clicking the Close-Button in Window2, the ContainerControls Textfield.Text Value should show Window2.Textfield1.Text. But ContainerControl.Textfield1.Text = “”. How to get it working?

[h]ContainerControl.Pushbutton1.Action[/h]

Window2.ShowModal Textfield1.Text = Window2.Textfield1.Text

[quote=249284:@Martin Trippensee]Hi,

I created a ContainerControl with a Textfield and a Button. If the Button is clicked, Window2 will show. Window2 has also a Textfield and a Button. After clicking the Close-Button in Window2, the ContainerControls Textfield.Text Value should show Window2.Textfield1.Text. But ContainerControl.Textfield1.Text = “”. How to get it working?

[h]ContainerControl.Pushbutton1.Action[/h]

Window2.ShowModal Textfield1.Text = Window2.Textfield1.Text[/quote]

Try setting Windows1.TextField1.Text property in the Window2.Textfield1 TextChange event instead of when you close the window.

Window2 contains:
—a property myReturnStr As String
—a method: GetStrValue As String

Window2.GetStrValue me.showModal return myReturnStr

Window2.Close myReturnStr = TextField1.Text

Window1... TextField1.Text = Window2.getStrValue()

[code]Class Window2 Inherits Window

Private Property mReturnValue As String

Event CloseButton_Action()
mReturnValue = TextField1.Text
Self.Hide() // This will hide win2 and the code after Window1.ShowModal will resume
End

Private Sub Close() // this overrides the built-in Close method
Super.Close()
End

Public Function Close() As String
Self.Close()
Return mReturnValue
End

End[/code]
In Window1:

Dim win2 As New Window2() win2.ShowModal() Dim s As String = win2.Close()