title: How to pass a form as the parameter of a function vb.net
body: <p>Currently in VB.NET I have two public subs like so:</p>
  
  <pre><code>Public Sub addmember1()
      'Stuff
  End Sub
  
  Public Sub furtherinfo1()
      'suff
  End Sub
  </code></pre>
  
  <p>I haven't included the code where "'stuff" is as it is very long and is <strong>exactly the same</strong> in each sub, however the underlying the principle remains the same. </p>
  
  <p>A certain sub is ran depending on a boolean value. like so...</p>
  
  <pre><code>If add_member = True Then
      addmember1()
  ElseIf add_member = False Then
      furtherinfo1()
  End If
  </code></pre>
  
  <p>How would I use one function to carry out the same procedure as above? (my current solution works but involves repeating the same section of code twice )</p>
  
  <p>I tried the following however was unsuccessful</p>
  
  <pre><code>Public Function forms(ByVal frm As Windows.Forms.Form)
      'stuff
  End Function
  </code></pre>
  
  <p>and then run the function like so... (addmember and furtherinfo are the two forms I am working with)</p>
  
  <pre><code>        If add_member = True Then
              forms(addmember)
          ElseIf add_member = False Then
              forms(furtherinfo)
          End If
  </code></pre>
  
  <p>here is the paste bin of all the code for context it's in modual and I want to use it for writing information to a word document. Lines 20-71, 76-128, 160-164 is what I am on about.</p>
  
  <p><a href="http://pastebin.com/xWD0RBuh" rel="nofollow">http://pastebin.com/xWD0RBuh</a></p>