473,396 Members | 1,773 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,396 software developers and data experts.

How to cast the arguments in the MdiChildActivate event?

Hi,

I am working with an Mdiform and several Childforms who are loaded
dynamically with reflection.
Every time a child is getting activate i must reinitialize the menu.
(i think) This is something to handle in the MdiChildActivate event of the
MdiForm.

My problem now is to get the initial properties of the active child.
When i try to cast the "e" arguments to
((System.Windows.Forms.Form)e).GetHashCode() it gives me a compile error
"Cannot convert type 'System.EventArgs' to 'System.Windows.Forms.Form".

Now the question. What is the correct cast for this?

Kind regards,

Ronny
Nov 15 '05 #1
2 6366
Ronny,

The EventArgs instance that was passed in doesn't have any information
about the child being activated. Also, it is of type EventArgs, which can
not be cast to a type of System.Windows.Forms.Form. You will have to get
the active mdi child using the MDI parent form's ActiveMdiChild property.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Ronny Van Assche" <va*****@hotmail.com> wrote in message
news:Oi**************@TK2MSFTNGP09.phx.gbl...
Hi,

I am working with an Mdiform and several Childforms who are loaded
dynamically with reflection.
Every time a child is getting activate i must reinitialize the menu.
(i think) This is something to handle in the MdiChildActivate event of the
MdiForm.

My problem now is to get the initial properties of the active child.
When i try to cast the "e" arguments to
((System.Windows.Forms.Form)e).GetHashCode() it gives me a compile error
"Cannot convert type 'System.EventArgs' to 'System.Windows.Forms.Form".

Now the question. What is the correct cast for this?

Kind regards,

Ronny

Nov 15 '05 #2
Thanks Nicholas
"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard.caspershouse.com> wrote in
message news:uY****************@TK2MSFTNGP10.phx.gbl...
Ronny,

The EventArgs instance that was passed in doesn't have any information
about the child being activated. Also, it is of type EventArgs, which can
not be cast to a type of System.Windows.Forms.Form. You will have to get
the active mdi child using the MDI parent form's ActiveMdiChild property.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Ronny Van Assche" <va*****@hotmail.com> wrote in message
news:Oi**************@TK2MSFTNGP09.phx.gbl...
Hi,

I am working with an Mdiform and several Childforms who are loaded
dynamically with reflection.
Every time a child is getting activate i must reinitialize the menu.
(i think) This is something to handle in the MdiChildActivate event of the MdiForm.

My problem now is to get the initial properties of the active child.
When i try to cast the "e" arguments to
((System.Windows.Forms.Form)e).GetHashCode() it gives me a compile error
"Cannot convert type 'System.EventArgs' to 'System.Windows.Forms.Form".

Now the question. What is the correct cast for this?

Kind regards,

Ronny


Nov 15 '05 #3

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

Similar topics

18
by: Graham Nicholls | last post by:
Hi. I'm having some fun with numbers. I've extraced an image sizes from a jpeg file img_x,img_y=image.getsize() then I'm trying to use those sizes to scale the image, but because python...
5
by: deko | last post by:
I'd like to use a bit of code in the OnOpen event of a report: =rptOpen(Me.ReportName), (Me.Tag) --this doesn't work This does work: Private Sub Report_Open(Cancel As Integer)...
5
by: MC | last post by:
Hi If I have a pointer to a some structure say for example payroll_ptr where struct payroll { ... } has some members and if i use a function argument as int function_process ( (payroll_ptr)...
36
by: MSG | last post by:
The answer is neither. Use macros. #define ALLOC(size, type) ((type) *) malloc((size) * sizeof(type)) #define NEW(type, name, size) (type) * (name) = ALLOC((size), (type)) They are both ...
17
by: Hazz | last post by:
In this sample code of ownerdraw drawmode, why does the '(ComboBox) sender' line of code need to be there in this event handler? Isn't cboFont passed via the managed heap, not the stack, into this...
15
by: Pohihihi | last post by:
This might sound little stupid to many but I was thinking that when we can use object why we really need event args to pass in any functions e.g. bool MyFunction(object sender, System.EventArgs...
9
by: rsine | last post by:
I have developed a program that sends a command through the serial port to our business system and then reads from the buffer looking for a number. Everything worked great on my WinXP system, but...
0
by: **Developer** | last post by:
Form.MdiChildActivate Event Occurs when a multiple document interface (MDI) child form is activated or closed within an MDI application. I need to know in the MdiChildActivate event handler...
6
by: Dean Slindee | last post by:
When you drop a button on a form, a Click event is created by the designer. Within the Click event certain event parameters are defined: Private Sub btnInsert_ButtonPressed(ByVal sender As...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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
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...

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.