showModalDialog
-
Hi all, i am using showModalDialog to open the popup window. I am sending one object from parent window to child window and doing some processing in child window. Now I have to set the values in the parent window based on the calculations in the child window. I came to know that from the child window, we can set the values for the controls which are in parent. I appreciate if some one can let me know how to do this….. Thanks in advance, Rahi
If you look at what you do not have in life, you don't have anything, If you look at what you have in life, you have everything... "
-
Hi all, i am using showModalDialog to open the popup window. I am sending one object from parent window to child window and doing some processing in child window. Now I have to set the values in the parent window based on the calculations in the child window. I came to know that from the child window, we can set the values for the controls which are in parent. I appreciate if some one can let me know how to do this….. Thanks in advance, Rahi
If you look at what you do not have in life, you don't have anything, If you look at what you have in life, you have everything... "
This article, http://www.codeproject.com/dotnet/passingvaluesbetweenforms.asp[^] may be of help for you...
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
-
This article, http://www.codeproject.com/dotnet/passingvaluesbetweenforms.asp[^] may be of help for you...
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
Thanks Paul for responding to my query. I saw this article. Nice one. Unfortunately, I didn't find the solution for my problem. In this Article, Colin focused on passing the data from Parent to child but not child to parent. I am sending some data from the parent form to child in the form of object, when the user closes the popup window; I want to populate the controls which are placed on parent form, with the data which is processed in child form. Thanks, Rahi -- modified at 23:45 Saturday 28th July, 2007
If you look at what you do not have in life, you don't have anything, If you look at what you have in life, you have everything... "
-
Thanks Paul for responding to my query. I saw this article. Nice one. Unfortunately, I didn't find the solution for my problem. In this Article, Colin focused on passing the data from Parent to child but not child to parent. I am sending some data from the parent form to child in the form of object, when the user closes the popup window; I want to populate the controls which are placed on parent form, with the data which is processed in child form. Thanks, Rahi -- modified at 23:45 Saturday 28th July, 2007
If you look at what you do not have in life, you don't have anything, If you look at what you have in life, you have everything... "
I thought you were going from child to parent, my misunderstanding :-O Good way to pass data from parent to child could be to modify the constructor for the child form to have a parameter that is the data you want to pass. For example, if I wanted to pass a string from MyTextBox.text from the parent to child, I could do something like:
... Dim MyChildForm As New ChildForm( MyTextBox.text ) MyChildForm.Show ' or ShowDialog
In the code for ChildForm, you would have the constructor look like:
Dim Private MyParentString As String Public Sub New(ByVal MyTextString As String) MyParentString = MyTextString End Sub
Change the form names to the ones you are using, and the data and datatype of what you are passing.
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
-
I thought you were going from child to parent, my misunderstanding :-O Good way to pass data from parent to child could be to modify the constructor for the child form to have a parameter that is the data you want to pass. For example, if I wanted to pass a string from MyTextBox.text from the parent to child, I could do something like:
... Dim MyChildForm As New ChildForm( MyTextBox.text ) MyChildForm.Show ' or ShowDialog
In the code for ChildForm, you would have the constructor look like:
Dim Private MyParentString As String Public Sub New(ByVal MyTextString As String) MyParentString = MyTextString End Sub
Change the form names to the ones you are using, and the data and datatype of what you are passing.
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
Sorry Paul, i sent the wrong message...just now i modified my message. i am able to pass the data(in the form of object) from parent to child. my problem is i have to pass the data from child to parent. when user clicks on Close Button on child(pop-up window), i have to populate the controls which are on Parent form. Thanks once again for your response... Rahithi
If you look at what you do not have in life, you don't have anything, If you look at what you have in life, you have everything... "
-
Sorry Paul, i sent the wrong message...just now i modified my message. i am able to pass the data(in the form of object) from parent to child. my problem is i have to pass the data from child to parent. when user clicks on Close Button on child(pop-up window), i have to populate the controls which are on Parent form. Thanks once again for your response... Rahithi
If you look at what you do not have in life, you don't have anything, If you look at what you have in life, you have everything... "
The child form, you could overload the Close method with something like:
Overloads Function Close() As { Your-DataType-Of-Data-To-Pass-Back } Return { The-Data-You-Want-Parent-To-Get-From-Child } End Function
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
-
The child form, you could overload the Close method with something like:
Overloads Function Close() As { Your-DataType-Of-Data-To-Pass-Back } Return { The-Data-You-Want-Parent-To-Get-From-Child } End Function
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
Ok!! i will try this . but one more simple doubt.........is it possible to directly populate the data in the parent controls using this overloaded close function?? Many Thanks, Rahi
If you look at what you do not have in life, you don't have anything, If you look at what you have in life, you have everything... "
-
Ok!! i will try this . but one more simple doubt.........is it possible to directly populate the data in the parent controls using this overloaded close function?? Many Thanks, Rahi
If you look at what you do not have in life, you don't have anything, If you look at what you have in life, you have everything... "
Are you loading a dataset or something like that (datatable adapter, datarows, etc) in the child form? If so, pass the dataset back as a return value from the overloaded Close function.
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
-
Are you loading a dataset or something like that (datatable adapter, datarows, etc) in the child form? If so, pass the dataset back as a return value from the overloaded Close function.
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
paul, thanks alot for your answer!!!!! i am sending Collection (object) to child window. almost 20 records(30 columns per record) of data but now i need only 4 values (need to populate 4 text box controls)from child window. i heard that if we use Show model dialogue to open the pop-up window, we can directly access the Parent winodow controls in the pop-up window, so that we can set the values directly from child window it self..i mean no need to pass the data using sessions..or anything... please discard my statement if it is wrong.......i am new to .Net technology.......this is my first project. when user hits on Close button on child window, parent window gets focused....at the same time we have to show these values on parent. any idea??????????? Thanks, Rahi
If you look at what you do not have in life, you don't have anything, If you look at what you have in life, you have everything... "
-
Ok!! i will try this . but one more simple doubt.........is it possible to directly populate the data in the parent controls using this overloaded close function?? Many Thanks, Rahi
If you look at what you do not have in life, you don't have anything, If you look at what you have in life, you have everything... "
Hi Rahithi Add this property to your child form:
Private Readonly Property OwnerForm As ParentForm
Get
Return Me.OwnerForm
End Get
End PropertyNow you can access any property you expose on your parent form from your child form's Close event. HTH