Results 1 to 6 of 6

Thread: [RESOLVED] Form inside a From

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Oct 2006
    Posts
    375

    [RESOLVED] Form inside a From

    Hey guys,

    I have one main form(form1) where i would like to chose other forms to open inside it but i dont know how to do that. For example, i made a screen shot of the main form(form1). I wanted that when i click in the report button to open another form(form2) i have inside the area that i draw in black. How can i do that?
    Also can i change the debuggin form, because when i debug my application it always shows the form2 and i wanted it to show the form one.



    Thx in advance for the help
    Last edited by super_nOOb; Nov 30th, 2006 at 05:21 AM.

  2. #2
    Addicted Member
    Join Date
    Sep 2006
    Location
    Surabaya, Indonesia
    Posts
    163

    Re: Form inside a From

    Use MDI form to make your first form as container of other forms.
    Set IsMDIContainer to true. Remember, this is read only property, which mean only can be set at design time.

    To make your form1 appear first, go to project properties, select application tab. At startup form, select the form that you desired as startup.

    Regards

    Michael

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Oct 2006
    Posts
    375

    Re: Form inside a From

    @ michaelrawi - Thx for the tips. Now the form1 is being debugged 1st. The report button opens the form2. But the form2 is being opened as a popup. How can i set it to be shown inside de MDI container?

    Thx for teh help Michael

    Rafael

  4. #4
    Lively Member
    Join Date
    Nov 2006
    Posts
    116

    Re: Form inside a From

    Something like

    VB Code:
    1. Dim frmRpt as frmReport = new frmReport
    2. frmRpt .MdiParent = me
    3. frmRpt.Show()

  5. #5

    Thread Starter
    Hyperactive Member
    Join Date
    Oct 2006
    Posts
    375

    Re: Form inside a From

    works perfect

    thx lingsn

  6. #6
    Frenzied Member
    Join Date
    Mar 2005
    Location
    Sector 001
    Posts
    1,577

    Re: [RESOLVED] Form inside a From

    Another way if you want the second form to be easily made to look like a part of the first form (the user can't drag it etc.)
    VB Code:
    1. Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
    2.  
    3.         Dim InsideForm As New Form2
    4.         InsideForm.TopLevel = False
    5.         Me.Controls.Add(InsideForm)
    6.  
    7.         InsideForm.FormBorderStyle = FormBorderStyle.None
    8.  
    9.         'where to show the from, the coordinates are relative to the mother form, not the screen
    10.         InsideForm.Left = 20
    11.         InsideForm.Top = 20
    12.  
    13.         InsideForm.BackColor = Color.Blue 'just a demonstration where the second form is
    14.  
    15.         InsideForm.Show()
    16.  
    17.     End Sub
    VB 2005, Win Xp Pro sp2

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width