Reference mdiParent controls from child form


G

Guest

Hi

I've noticed a couple of postings on this topic. I'm either not uderstanding
them or I'm missing something.

My app uses an MDIParent form (frmCAD).
A menu item on frmCAD shows a child form (frmHistoricalCall). It also
another menu item on frmCAD to "enabled = false", to prevent other forms
being opened when frmHistoricalCall is in use. That menu item has it's
modifier property set at "public".

frmHistoricalCall has a button to close the form. Before closing it attempts
to set the menu item on frmCAD to "enabled = true".

The code I'm using to re-enable the menu item in frmCAD is returning an
error "Object reference not set to an instance of an object"

Here is the code I'm using. Where is it wrong or what is missing

Public Class frmCAD
Private Sub HistoricalCallRecordToolStripMenuItem_Click(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
HistoricalCallRecordToolStripMenuItem.Click
Me.ReceiveCallToolStripMenuItem.Enabled = False
Dim frmNew As New frmHistoricalCall()
frmNew.MdiParent = Me
frmNew.Show()
End Sub
End Class


Public Class frmHistoricalCall
Private Sub btnEndAndExit_Click(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles btnEndAndExit.Click
Me.MDIParent.Controls("ReceiveCallToolStripMenuItem").Enabled = True
Me.Close()
End Sub
End Class

Thanks for any help

Michael Bond
 
Ad

Advertisements

G

Guest

Must be getting better at this, I'm now answering my own questions.

Cos I'm using vb.net 2005 I should be using the My namespace. The code line
should read

My.Forms.frmCAD.ReceiveCallToolStripMenuItem.Enabled = True

Thanks anyway

Michael Bond
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top