Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

From my main form, in a combo box, I call a second form like this:

 

dim NewForm as form2

NewForm = new form2

NewForm.show

 

After the user completes their work in form2, I need to get back to form1. How can I do this? If I do this from form2...

 

dim OrigForm as form1

OrigForm = form1

form1.show

 

...it creates another instance of form1. I need to get back to my original form1. How can I go back and forth from one form to another without re-creating them each time?

 

Thanks in advance

Ben

Posted

Answer I think

 

If form1 is your startup form it should still be open. All you should have to do is close form2 and the program should refocus on form1 you do not need to add any additional code.

Posted
I could be wrong, but from the little you've said I would guess that you want a modal dialogue, i.e. a dialogue that prevents access to its opener until you dismiss it, like a MessageBox. If I am correct, you should display your form by calling ShowDialog instead of Show. ShowDialog does not return until the new window is closed, at which point it returns the value of the form's DialogResult property, which is supposed to indicate what button was used to dismiss the form, once again like a MessageBox.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...