#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2012
    Posts
    3
    Rep Power
    0

    Help simple vb programing form


    hi... i am doing a project on windows form application in vb.An example i have 2 windows form name Form1 and Form2 and each of them have a button name Button1. In the first forms button i put Form2.Show(), this will pop up Form2 in a new window

    is it possible if i want Form2 to show in Form1 window?? Example, when i click on the button in Form1 it would switch to Form2 instead of poping out

    thanks =D
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2011
    Posts
    289
    Rep Power
    45
    I don't really understand your question. When you execute Form2.Show, it will load the window if it is not already loaded and then display it with the focus. If it is already loaded and displayed, it will shift the focus to Form2. If what you are after is to have Form2 displayed within the boundaries of Form2, you can adjust the size and location of any form using code. The only option you have is whether or not the form is displayed modal. A modal form will not return control to the calling form until it has been unloaded. For example, I would use a modal form to enter a password.

    J.A. Coutts

    Comments on this post

    • james dawson agrees
  4. #3
  5. Humble Learner
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2007
    Location
    Bangalore, India
    Posts
    280
    Rep Power
    120
    try this

    in the click event of Button 1 in form 1

    Form2.Show()
    me.hide

    in the click event of Button 1 in form 2

    Form1.Show()
    me.hide

    Comments on this post

    • james dawson agrees
  6. #4
  7. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2012
    Posts
    3
    Rep Power
    0
    Originally Posted by couttsj
    I don't really understand your question. When you execute Form2.Show, it will load the window if it is not already loaded and then display it with the focus. If it is already loaded and displayed, it will shift the focus to Form2. If what you are after is to have Form2 displayed within the boundaries of Form2, you can adjust the size and location of any form using code. The only option you have is whether or not the form is displayed modal. A modal form will not return control to the calling form until it has been unloaded. For example, I would use a modal form to enter a password.

    J.A. Coutts
    thanks for the reply.... but i m looking for the answer below.
  8. #5
  9. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2012
    Posts
    3
    Rep Power
    0
    Originally Posted by debasisdas
    try this

    in the click event of Button 1 in form 1

    Form2.Show()
    me.hide

    in the click event of Button 1 in form 2

    Form1.Show()
    me.hide
    thanks for the answer =D

IMN logo majestic logo threadwatch logo seochat tools logo