Results 1 to 3 of 3

Thread: Loading Forms *RESOLVED*

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Oct 2000
    Location
    Chesterfield, UK
    Posts
    298

    Loading Forms *RESOLVED*

    When loading forms at the moment I am using the following -

    VB Code:
    1. Sub LoadReportsForm()
    2.         Dim NewMDIChild As New frmReportViewer()
    3.         'Set the Parent Form of the Child window.
    4.         NewMDIChild.MdiParent = Me
    5.         'Display the new form.
    6.         NewMDIChild.Show()
    7.     End Sub

    But I could end up with around 15 forms in my solution and I don't really think I want to use this code for each form.

    Is there a way that I can make this into one sub that will load any form by just specifying the form I would like to load???

    Regards,


    Matt.
    Last edited by MattJH; Jul 16th, 2003 at 06:26 AM.

  2. #2
    Frenzied Member dynamic_sysop's Avatar
    Join Date
    Jun 2003
    Location
    Ashby, Leicestershire.
    Posts
    1,142
    you could do this :
    VB Code:
    1. Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
    2.         LoadReportsForm("frm", New Form2())
    3.     End Sub
    4.  
    5.     Private Sub LoadReportsForm(ByVal strname As Object, ByVal strform As Object)
    6.         strname = strform
    7.         strname.MdiParent = Me
    8.         strname.Show()
    9.     End Sub

    hope it helps.
    ~
    if a post is resolved, please mark it as [Resolved]
    protected string get_Signature(){return Censored;}
    [vbcode][php] please use code tags when posting any code [/php][/vbcode]

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Oct 2000
    Location
    Chesterfield, UK
    Posts
    298

    Thumbs up

    Brilliant, Thank you very much!!!!!!


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