title: Change the datatable in Form1 from Form2 Visual Basic
body: <p>So i have this code in the form called <code>MyMenuForm</code>. </p>
  
  <pre><code>Public Class MyMenuForm
  
      Public Sub LoadForm(sender As Object, e As EventArgs)
          DataGrid.DataSource = DataGridTable
          DataGridTable.Columns.Add("Name", GetType(String))
          DataGridTable.Columns.Add("Verison", GetType(String))
          DataGridTable.Columns.Add("Compile", GetType(Button))
          DataGridTable.Columns.Add("Location", GetType(String))
          DataGridTable.Columns.Add("CompileLoc", GetType(String))
      End Sub
  
      Public DataGridTable As DataTable
  
  End Class
  </code></pre>
  
  <p>I want to be able to edit <code>DataGridTable</code> from a different form called <code>AddForm</code>.</p>
  
  <pre><code>Public Class AddForm
  
      Public Sub Add_Click(sender As Object, e As EventArgs) Handles AddButton.Click
          MyMenuForm.DataGridTable.Rows.Add(NameBox(), VersionBox(), "Compile", LocationBox(), CompileBox())
      End Sub
  
  End Class
  </code></pre>
  
  <p>When I click on the <code>AddButton</code> button, I receive the error</p>
  
  <pre><code>Additional information: Object reference not set to an instance of an object.
  </code></pre>
  
  <p>Does anyone know why this happens or how I can fix it? I have googled to the extent of my ability and have found no solution. Please Help.</p>