473,406 Members | 2,467 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,406 software developers and data experts.

Accessing public sub in MdiParent form

My project uses a MDI parent form and several child forms. I need to call a
public sub in the parent form (which is also the startup object) from one of
the child forms in order to change the appearance of the toolbar under
certain conditions. So far I have not figured out how to reference the sub
from another form.

One member of this group suggested I use the statement:
CType(Me.Owner, frmMain).tbMainReset()

where "tbMainReset" is a public sub in the parent form. However, running
this statement gives me the error: "Object reference not set to an instance
of an object."

Thanks for any advice.
Steve Enzer
Nov 21 '05 #1
2 1287
"Steve Enzer" <en***@frontiernet.net> schrieb:
My project uses a MDI parent form and several child forms. I need to call
a public sub in the parent form (which is also the startup object) from
one of the child forms in order to change the appearance of the toolbar
under certain conditions. So far I have not figured out how to reference
the sub from another form.

One member of this group suggested I use the statement:
CType(Me.Owner, frmMain).tbMainReset()


This solution is close to the /real/ solution. Simply use the 'MdiParent'
property instead of the 'Owener' property:

\\\
DirectCast(Me.MdiParent, MainForm).ResetMainToolBar()
///

Note that you have to set the MDI child's 'MdiParent' property to the MDI
container form, which is pretty obvious and required in order to show a form
as an MDI child.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

Nov 21 '05 #2
This works great! Thank you very much for your help.
Nov 21 '05 #3

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

Similar topics

1
by: James Li | last post by:
Here is the code in the calling form: Form frmDetails = new employeeDir.details (); frmDetails.MdiParent = this.MdiParent; frmDetails.DisplayForm(1); Here is the code in detail form: ...
11
by: alex | last post by:
Hi, how can I access / set properties of controls in other forms. i.e. mdi parent of mdi child mdi child of mdi child mdi child of mdi parent Thanks Alex
8
by: Alex Levi | last post by:
If I have a parent form (form1) and 2 child forms (Form2 and Form3). How can I excecute a function that located on Form3 from Form2 ? I'm using this commands to load the child forms: (VB.NET...
2
by: Gary Townsend | last post by:
I have seen similar requests to this but not quite what i was looking for i have an mdi interface and i have 3 child forms 2 are application forms (meaning they do stuff for the application) and...
6
by: Steve Enzer | last post by:
My project uses a MDI parent form and several child forms. I need to call a public sub in the parent form (which is also the startup object) from one of the child forms in order to change the...
0
by: Miro | last post by:
I searched google and I think I have solved the issue. Again, if someone could quickly skim over my example and lemmi know if it is the "correct" way of doing things. It works, but again - is it...
0
by: ZackariyaYoosuf | last post by:
Hi guys,anyone can help me... I have to set a form's mdiparent property at run time..But I have the formname as string..how can I do it.. I tried this way .. 'Dim _form As Form =...
0
by: kardiss | last post by:
I am trying to add Meebo's "Pop-out" kinda feature to my application which when a button is pressed in a MdiChild form, it kicks that MdiChild form out of the MdiParent boundary and acts like a SDI...
9
by: l3mon | last post by:
So have two forms under the same namespace and I need to be able to access a richtextbox attached to the form "Home" from the form "Editor". But whenever I try to access it it doesn't come up, I'm...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new...

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.