Click here to Skip to main content
15,887,214 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi, I am using Windows media player in my project, if I call media player from my main form its playing, I have written code that when I click Wmp it goes to main form but when I do this it is showing "Attempted to read or write protected memory. This is often an indication that other memory is Corrupt". Can anyone provide solution for this, Thanks in advance .



Mainform code:

Frmads frm=new frmads(this);
Frm.show();
This.hide();

Ads Form code:

If(e.newstate = =2)
{
Frmmain.Activate();
Frmmain.show();
This.close();
}

What I have tried:

Please give a solution of this issue soon. Thanks in advance
Posted
Updated 16-Jun-17 21:33pm

1 solution

Don't do it that way.
Instead, handle the Frmads.FormClosing event, and in the handler re-display your main form.

The "child" form should not even know that the "parent" even exists, much less that it is hidden and needs redisplaying.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900