Results 1 to 4 of 4

Thread: how do i go about this?

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Jun 2007
    Posts
    403

    how do i go about this?

    hi,

    im trying to create a global procedure in my class module that calls a form

    i have these codes on every form but the form im calling differs... this is just an example.
    Code:
    'Code I have in my Form1 in a button to call Form2.
    Dim myForm2 as New Form2
    myForm2.MdiParent = Me.MdiParent
    myForm2.Show
    i tried creating a module and placed these codes

    Code:
        Public Sub Load_Form(ByVal FormToLoad As Form)
            Dim Active_Form As New FormToLoad
            Active_Form.MdiParent = Me.MdiParent
            Active_Form.Show
        End Sub
    unfortunately, there are some errors on this. those underlined causes some problems... are there any other approach on how to do this?

    VB Version: Microsoft Visual Studio 2008 Professional Edition
    .NET Version: Microsoft .NET Framework Version 3.5
    OS: Windows XP SP3

  2. #2
    Lively Member
    Join Date
    Jul 2007
    Posts
    78

    Re: how do i go about this?

    Hi

    u can use technique of late binding like below

    vb Code:
    1. Public Sub loadForm(ByVal frm As Form)
    2.         Dim f As New Form
    3.         f = frm
    4.         f.MdiParent = MDIParent1
    5.         f.Show()
    6.     End Sub

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Jun 2007
    Posts
    403

    Re: how do i go about this?

    thanks.. this works ok.

    VB Version: Microsoft Visual Studio 2008 Professional Edition
    .NET Version: Microsoft .NET Framework Version 3.5
    OS: Windows XP SP3

  4. #4
    PowerPoster stanav's Avatar
    Join Date
    Jul 2006
    Location
    Providence, RI - USA
    Posts
    9,290

    Re: how do i go about this?

    It's not gonna work if you want to load a specific form... It only load a generic blank form for you with that code.

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