|
-
May 20th, 2007, 10:49 PM
#1
Thread Starter
Addicted Member
[RESOLVED] Form Reload in Windows Application
Hi, I would like to cause my One of my Forms ( Parent Form ) to Reload when the Child Form closes. I know how this can be accomplised in Web Applications but not in Windows Applications. Can Anyone please tell me how?
thanks in Advance
Reaction
Last edited by Reaction; May 22nd, 2007 at 06:32 AM.
-
May 20th, 2007, 11:43 PM
#2
Re: [2005] Form Reload in Windows Application
There's no such thing as reloading a form in a Windows app. A form is "loaded" the first time it becomes visible and never again. You could destroy the form object and create a new one but there is no possible reason for that to be required.
Presumably you mean you want the data displayed in the control(s) on a form to be updated with any changes you made in the child dialogue. If you've used data-binding properly then that will be taken care of automatically. See this thread for an example.
Even if you haven't used data-binding, displaying data in a control is simply a matter of assigning the data to be displayed to the appropriate properties of the control displaying it. For instance, if you want to display unbound data in a TextBox you simply assign that data to its Text property. That's the case whether the form is being loaded or some dialogue has just been dismissed.
-
May 22nd, 2007, 05:15 AM
#3
Thread Starter
Addicted Member
Re: [2005] Form Reload in Windows Application
What I want to do is Unload a Form and then load the forms Parent when the user clicks the Close Button on the form. Problem is I hid the parent form and instead would like to close it, open the child form and when the child form is closed, Open the parent form again as in reload it.
Me.close() does not work
vb Code:
Private Sub Vendor_Closing(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles MyBase.Closing
If MessageBox.Show("Do you want to exit application completely?", "Quit Form", MessageBoxButtons.YesNo, MessageBoxIcon.Question) = Windows.Forms.DialogResult.Yes Then
'do nothing
Application.Exit()
Else
'e.Cancel = True
Me.Close()
End If
End Sub
Can you suggest a better way to do this please?
Reaction
-
May 22nd, 2007, 05:48 AM
#4
Fanatic Member
Re: [2005] Form Reload in Windows Application
the closing event is triggered when the form is already being closed so I don't think that using me .close will have any effect in your program.
I would suggest that you put that code inside a button event instead of closing event of the form.
vb Code:
private sub button1_click()sender as object, e as eventArgs) Handles button1.click
If MessageBox.Show("Do you want to exit application completely?", "Quit Form", MessageBoxButtons.YesNo, MessageBoxIcon.Question) = Windows.Forms.DialogResult.Yes Then
'do nothing
Application.Exit()
Else
'e.Cancel = True
Me.Close()
End If
end sub
-
May 22nd, 2007, 06:28 AM
#5
Re: [2005] Form Reload in Windows Application
 Originally Posted by Reaction
What I want to do is Unload a Form and then load the forms Parent when the user clicks the Close Button on the form. Problem is I hid the parent form and instead would like to close it, open the child form and when the child form is closed, Open the parent form again as in reload it.
Can you explain your reasoning for wanting to do that? I can't think of a good reason why that would be required. It sounds like flawed design to me.
-
May 22nd, 2007, 06:32 AM
#6
Thread Starter
Addicted Member
Re: [2005] Form Reload in Windows Application
Thanks. I finally got it fixed. Basically when I open the Child Form using CHILD.SHOW() I can Close the Parent and then when I close the Child I OPen the Parent Form from Scratch and iT fixes the Problem. The Problem was that initially when I was using the Child.ShowDialog(ME), it would not update the List when I closed the Child Form. That was the reason I started searching for a reload method.
Thanks for the Help. Greatly Appreciated
Reaction
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|