So i have this code in the form called MyMenuForm
.
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
I want to be able to edit DataGridTable
from a different form called AddForm
.
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
When I click on the AddButton
button, I receive the error
Additional information: Object reference not set to an instance of an object.
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.