Windows media player problem
-
my application is windows based (C#.net) i have two forms both containing a windows media player i go to first form(Form 1) and start a file in media player now if i go to second form and start a file in media player there also , the media player in form 1 should stop how will i achieve this?? i have tried all the methods but nothing have worked like Test ts = new Test(); [First Form] ts.axWindowsMediaPlayer1.Stop(); ts.axWindowsMediaPlayer1.settings.volume=0; ts.axWindowsMediaPlayer1.Dispose(); ts.axWindowsMediaPlayer1.currentPlaylist.clear(); ts.axWindowsMediaPlayer1.close();[Error-com object that has been seperated from its underlying RCW cannot be used] plzz help
-
my application is windows based (C#.net) i have two forms both containing a windows media player i go to first form(Form 1) and start a file in media player now if i go to second form and start a file in media player there also , the media player in form 1 should stop how will i achieve this?? i have tried all the methods but nothing have worked like Test ts = new Test(); [First Form] ts.axWindowsMediaPlayer1.Stop(); ts.axWindowsMediaPlayer1.settings.volume=0; ts.axWindowsMediaPlayer1.Dispose(); ts.axWindowsMediaPlayer1.currentPlaylist.clear(); ts.axWindowsMediaPlayer1.close();[Error-com object that has been seperated from its underlying RCW cannot be used] plzz help
See when you create another object of form1 from form2, it doesn't mean you will get running instance. You need to get instance of same form previously loaded. So from the startup method, create two objects of form1 and form2 and use it in both form instead of creating new object and this will work.