how can i code for the windows media palyer in vb pls?

Recommended Answers

All 4 Replies

First you must add the component. (ctrl+T or project->component) then select for Windows Media Player.
You will see new control and just add it to your form.
try this to play a video :

WindowsMediaPlayer1.openPlayer "D:\father.mp4"
  1. Add OpenFileDialog
  2. Add Windows media Player (R Click Tools And Choose Add Item>> COM Compoments >> Corect Windows Media Player And Then You Can See Windows Media Player)
  3. Add 1 Button

    double Click Button And Try This Code

    OpenFileDialog1.ShowDialog()
    AxWindowsMediaPlayer1.URL = OpenFileDialog1.FileName
    AxWindowsMediaPlayer1.Ctlcontrols.play()
    

    Here is Full Code

    Public Class m

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        OpenFileDialog1.ShowDialog()
        AxWindowsMediaPlayer1.URL = OpenFileDialog1.FileName
        AxWindowsMediaPlayer1.Ctlcontrols.play()
    End Sub
    

    End Class

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.