Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 189
  • Last Modified:

creating a procedure to do multiple things

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
0
Orlando15767
Asked:
Orlando15767
1 Solution
 
appariCommented:
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

   
0
 
Orlando15767Author Commented:
yes exactly
thanks for the help
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now