We help IT Professionals succeed at work.

We've partnered with Certified Experts, Carl Webster and Richard Faulkner, to bring you a podcast all about Citrix Workspace, moving to the cloud, and analytics & intelligence. Episode 2 coming soon!Listen Now

x

creating a procedure to do multiple things

Orlando15767
Orlando15767 asked
on
Medium Priority
202 Views
Last Modified: 2010-04-23
I'm new to VB.NET and am creating an MDI application.

What I would like to do is create a procedure to accomplish a few simple tasks

the tasks that I want to complete by calling a procedure is:

        [form name]= New [form name]
        [form name].MdiParent = Me
        [form name].Show()

I want to do this because it seems pointless to write the 3 lines of code every time I want to create a new child form

thanks for the help
Comment
Watch Question

Commented:
is this what you are looking for?

   Private Sub MenuItem3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MenuItem3.Click
        openMyForm(New Form3)
    End Sub

   Private Sub MenuItem2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MenuItem2.Click
        openMyForm(New Form1)
    End Sub

    Private Sub openMyForm(ByVal frm As Object)
        Dim frmNew As Form
        frmNew = frm
        frmNew.MdiParent = Me
        frmNew.Show()
    End Sub

   

Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts

Author

Commented:
yes exactly
thanks for the help
Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.