it says that "opd" isn't declared
Yes!
No!
No, It did not work!
Yes, Make more!
None of the above.
Thanks :d, want me to make more?
it says that "opd" isn't declared
Interesting...........
Devasp.net has this tutorial...
Note: Same order as tutorial below (how likely is that)
Same names for the controls ( keep in mind you can choose any name, so how likely is that)
Same volume + settings (you can set that number to anything, both tuts set to + 10 and - 10, just to many similarities, identical )
If you make a tutorial and steal the code from someone elses hard work, at least have the decency to give them credit, start learning the language, and stop pretending you know it (thats general for all those who can't give proper credit and or plagiarize)
Start visual studio and create a new window application project.
Set the following properties of Form by using properties windows.
Now right click on the toolbar and from the menu choose “Add/Remove Items”. A dialog box will appear choose the “COM Component” tab. Search for windows media player and check it by clicking in the checkbox. Click ok. Now in your toolbox a new item is added with the name of window media player.Code:Text = Media Player, BoarderStyle = FixedSingle, maximizeBox = False, Size = 298,298
Drop this to your form and set the following properties.
Drop a main menu control to build the menu for media playerCode:Name = player, Size = 298,250
Build the menu in the following hierarchy and set there names as shown in parenthesis.
From toolbox drop a “OpenFileDialogBox” control to your form.Code:File Open (open) Exit (mexit) Player Play (play) Stop (mstop) Pause (mpause) Volume Up (mup) Down (mdown) Mute (mmute)
Set its name to “opd”.
Open the code window and write the code as below in your code window.
Code:Private Sub open_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles open.Click Try opd.InitialDirectory = "c:\" opd.ShowDialog() player.URL = opd.FileName player.Ctlcontrols.play() Catch ex As Exception MessageBox.Show("Some error occur so can't play media", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error) End Try End Sub
Code:Private Sub mexit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mexit.Click Application.Exit() End Sub
Code:Private Sub play_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles play.Click player.Ctlcontrols.play() End SubCode:Private Sub mstop_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mstop.Click player.Ctlcontrols.stop() End Sub
Code:Private Sub mpause_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mpause.Click player.Ctlcontrols.pause() End Sub
Code:Private Sub mup_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mup.Click player.settings.volume = player.settings.volume + 10 End SubCode:Private Sub mdown_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mdown.Click player.settings.volume = player.settings.volume - 10 End Sub
Code:Private Sub mmute_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mmute.Click If player.settings.volume = player.settings.mute() Then player.settings.volume = 20 Else player.settings.volume = player.settings.mute() End If End Sub
Last edited by NextGen1; 12-30-2009 at 05:06 PM.
Hell_Demon (01-03-2010)
does this work for vb 2008? coz it just says
Handles clause requires a WithEvents variable defined in the containing type or one of its base types, Name 'opd' is not declared.
Keyword is not valid as an identifier.
Name 'player' is not declared.
and there is double of these errors
When i finished it visual basic said the "opd" is not declared from the open part.
Try
opd.InitialDirectory = "c:\"
opd.ShowDialog()
player.URL = opd.FileName
player.Ctlcontrols.play()
Catch ex As Exception
MessageBox.Show("An error has occured, please try again.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
End Try
[IMG]https://i251.photobucke*****m/albums/gg291/h0tpinkninJa/NeilPeart.jpg[/IMG]