Manipulating Menus from a module / form2

H

Henry Wu

Hi, I have a MDIForm with a menu name mnuVideo that opens a childForm.

My question is a newbie question, I was wondering how can I manipulate
the mnuVideo that is in the MDIForm from the childForm? Like "enabled"
& "checked" properties.

Lastly I need to do the same manipulation of the mnuVideo from a
Module.

Code samples would be very much appreciated.

Here's what I did.

MDIForm's mnuVideo code
********************************************************************
Private Sub mnuVideo_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles mnuVideo.Click
Dim frmVideoPreviewInstance As New frmVideoPreview
frmVideoPreviewInstance.MdiParent = Me
frmVideoPreviewInstance.Show()
End Sub
********************************************************************


Load Event of ChildForm w/c doesnt work!
********************************************************************
Private Sub frmVideoPreview_Load(ByVal sender As System.Object, ByVal
e As System.EventArgs) Handles MyBase.Load

Dim mdiVideoInspectionInstance As New mdiVideoInspection

mdiVideoInspectionInstance.itmVideoStream.Enabled = True
mdiVideoInspectionInstance.itmVideoStream.Checked = True
mdiVideoInspectionInstance.itmVideoActualSize.Enabled =
True
mdiVideoInspectionInstance.itmVideoActualSize.Checked =
False
End Sub
********************************************************************

I did not attempt to make the code in the Modules I have because I
can't even get the ChildForm to change the MDIForm's menu. :(


Sample codes for ChildForm & Module to manipulate MDIForm's menu will
really be very much appreciated!!!

Thanks,
Henry
 
A

Armin Zingler

Henry Wu said:
Hi, I have a MDIForm with a menu name mnuVideo that opens a
childForm.

My question is a newbie question, I was wondering how can I
manipulate the mnuVideo that is in the MDIForm from the childForm?
Like "enabled" & "checked" properties.


I personally wouldn't make this approach. Instead, I would raise an event
within the child and have the MDI parent handle the event and reflect the
changes and states of the child form, in this case by setting the menu
properties. This way you don't have to access the parent at all, and
consequently the MDI child might be used together with other parent forms
(maybe in future).
Lastly I need to do the same manipulation of the mnuVideo from a
Module.

Why don't you put the code in the MDI parent?


--
Armin

How to quote and why:
http://www.plig.net/nnq/nquote.html
http://www.netmeister.org/news/learn2quote.html
 
H

Henry Wu

Hi, I was able to figure it out by placing a global public variable at
a seperate module for example videoGlobal as Form1 then placing
videoGlobal = Me at Form1's code before "InitializeComponent()" . It
works now, I'm not sure if what I did was "messy" or unprofessional,
but it would be great if I could learn form some sample codes how to
do it more professionally.

Thanks again for your time!!!
Henry
 

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