Hi Guys,
Im running a program with multiple forms with a menu and toolstrip defined and assigned with properties in a module. each form has the
in the form_load sub.
My problem is that these menu's have menuitems which need close the shown form and open another. a sample of one of my menuitems is:
It throws this error at *frm.close()*: Object reference not set to an instance of an object.
if i get rid of the public defined form (frm) and do as follows:
i get an error at *Handles RepairToolStripMenuItem.Click* saying:
Method 'Public Sub RepairToolStripMenuItem_Click(frm As System.Windows.Forms.Form, sender As Object, e As System.EventArgs)' cannot handle event 'Public Event Click(sender As Object, e As System.EventArgs)' because they do not have a compatible signature.
any help would be much appreciated.
Im running a program with multiple forms with a menu and toolstrip defined and assigned with properties in a module. each form has the
VB.NET:
Call menuload (Me)
in the form_load sub.
My problem is that these menu's have menuitems which need close the shown form and open another. a sample of one of my menuitems is:
VB.NET:
Module MenuTemplate
Friend WithEvents frm As Form
Friend WithEvents menustrip As New MenuStrip
Friend WithEvents RepairToolStripMenuItem As New ToolStripMenuItem
Public Sub menuload(ByVal frm As Form)
frm.Controls.Add(menustrip)
RepairToolStripMenuItem.Text = "Repair"
toolstrip.Items.Add(BookingToolStripDropDownButton1)
BookingToolStripDropDownButton1.DropDownItems.Add(NewBookingToolStripMenuItem1)
NewBookingToolStripMenuItem1.DropDownItems.Add(RepairToolStripMenuItem)
Public Sub RepairToolStripMenuItemClick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RepairToolStripMenuItem.Click
frm.close()
frmrepair.show ()
End Sub
It throws this error at *frm.close()*: Object reference not set to an instance of an object.
if i get rid of the public defined form (frm) and do as follows:
VB.NET:
Public Sub RepairToolStripMenuItemClick([B]ByVal frm As Form[/B], ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RepairToolStripMenuItem.Click
frm.Close()
End Sub
i get an error at *Handles RepairToolStripMenuItem.Click* saying:
Method 'Public Sub RepairToolStripMenuItem_Click(frm As System.Windows.Forms.Form, sender As Object, e As System.EventArgs)' cannot handle event 'Public Event Click(sender As Object, e As System.EventArgs)' because they do not have a compatible signature.
any help would be much appreciated.