title: Calling a method from different class to write text on a form. VB.NET
body: <p>I have two forms Form1 and Form 2. I am passing a function with three values from Form1 and want the load event of form2 to trigger this function.. Basically I want to "paint" the values of qseq, midline and hseq on form2</p>
  
  <pre><code>Public Class Form1 
  
      Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
          Dim f2 As New Form2
              Form2.Visible=True
              f2.DrawString(qseq, midline, hseq)
      End Sub
  End Class
  </code></pre>
  
  <p>Form2:</p>
  
  <pre><code>Public Class Form2
  
      Private Sub Form2_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
  
      End Sub
  
      Public Sub DrawString(ByVal qseq As String, ByVal midline As String, ByVal hseq As String)
          Dim formGraphics As System.Drawing.Graphics = Me.CreateGraphics()
          Dim drawString As String = qseq 'and similarly for midline and hseq
          Dim drawFont As New System.Drawing.Font("Arial", 16)
          Dim drawBrush As New  _
              System.Drawing.SolidBrush(System.Drawing.Color.Black)
          Dim x As Single = 200.0
          Dim y As Single = 100.0
          Dim drawFormat As New System.Drawing.StringFormat
          formGraphics.DrawString(drawString, drawFont, drawBrush, _
                                  x, y, drawFormat)
          drawFont.Dispose()
          drawBrush.Dispose()
          formGraphics.Dispose()
      End Sub
  End Class
  </code></pre>
  
  <p>When I run this, nothing gets printed on form2 as when load event is triggered thee drawstring method is not called. how can I call drawstring from load method as drawstring takes in arguments and is called from Form1 class. </p>