473,324 Members | 2,254 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,324 software developers and data experts.

Reference mdiParent controls from child form

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("ReceiveCallToolStripMenuIte m").Enabled = True
Me.Close()
End Sub
End Class

Thanks for any help

Michael Bond
Oct 20 '06 #1
1 5806
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.Enabl ed = True

Thanks anyway

Michael Bond
"mabond" wrote:
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("ReceiveCallToolStripMenuIte m").Enabled = True
Me.Close()
End Sub
End Class

Thanks for any help

Michael Bond
Oct 20 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Terrance | last post by:
I'm hoping that there's someone out here that can help me with a coding problem. Here is the scenerio: I have a MdiParent Form on this MdiParent form there is a listview control and several text...
2
by: Terrance | last post by:
Good Day, I have a programming problem and need some help/advice. I have a MdiParent Form that has a tool bar with icons on it. I have a child form that needs set the toolbar enabled property to...
4
by: Vaughn | last post by:
When I pass a reference to my current form, frm_x, when I create and show another form, frm_y, do I have access to all of the public methods, controls, members, etc.. of frm_x from frm_y? In my...
1
by: yin heng | last post by:
I am using c#2005 Beta to write a Mdi form, but I can't find the MDI properties as: IsMdiChild or MdiParent. I am a beginner of c#, is it the difference between .net 2003 edition and 2005 beta?...
16
by: John | last post by:
Hi I have posted this question several times but have received no reply. I have a main form which contains a panel which in turn contains a child form, like this; MainForm->MyPanel->ChildForm....
4
by: Ben dotNet | last post by:
FormA is the mdiParent FormB is the child FormC is the Form that is used to open FormB How do I open FormB from FormC (that is not a child) so that it it's mdiParent is FormA? Thanks, --Ben
1
by: PDP-8E | last post by:
I'm new to VB.Net 2003 - (2 weeks in) so this MAY be straightforward... (Things changed since Octal Assembler I see !!!) I'll try to lay this out in a way that makes sense I created a...
3
by: MuZZy | last post by:
Hi, I wounder if someone could help me here: app has an MdiParent form - i need to get some notification in form of an event when any MdiChild forms are added to/removed from...
2
by: =?Utf-8?B?U2FuZHk=?= | last post by:
Hi everyone Some help pls. 1. MDI Parent Form Have a variable Public TestVariable As String = "AAA" In the Load procedure TestVariable = "BBB" 2. MDI Child Form
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.