Sound in visual basic 6.0

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Jeroen van vliet

    Sound in visual basic 6.0

    Hello all,

    I have an ado control with an access dbase and i want to make a button that
    when its clicked a specified wav or mp3 file will be played in accordance
    with each record on the access database. Does anyone know how do do this?

    Jeroen


  • edoepke

    #2
    Re: Sound in visual basic 6.0

    This will get you started on how to play music files. Modify it and you
    should be able to get close to what you want.



    Private WithEvents p As MediaPlayer.Med iaPlayer

    'Place 2 Command Buttons on your form and name them "cmdPlay" and "cmdStop".
    To control the volume, place a slider control on your form and 'set the Min
    to -10000 (No volume) and the Max to 0 (Full Volume). Set the SelStart
    Property to somewhere in the middle of your range. I've also 'placed a Label
    with the caption "Volume". Now paste the following code into your project.

    Private Sub cmdPlay_Click()
    ButtonControl
    p.Volume = Slider1.Value
    'I've defined MySelection from a selected item in a listbox control
    p.Open MySelection
    End Sub

    Private Sub cmdStop_Click()
    p.Stop
    ButtonControl
    End Sub

    Public Sub ButtonControl()
    p.Stop
    cmdStop.Enabled = Not cmdStop.Enabled
    cmdPlay.Enabled = Not cmdPlay.Enabled
    Slider1.Visible = Not Slider1.Visible
    Label2.Visible = Not Label2.Visible
    End Sub

    Private Sub Slider1_Scroll( )
    p.Volume = Slider1.Value
    End Sub

    "Jeroen van vliet" <asdasd@asdasd. nl> wrote in message
    news:brd94f$1d4 $1@reader11.wxs .nl...[color=blue]
    > Hello all,
    >
    > I have an ado control with an access dbase and i want to make a button[/color]
    that[color=blue]
    > when its clicked a specified wav or mp3 file will be played in accordance
    > with each record on the access database. Does anyone know how do do this?
    >
    > Jeroen
    >
    >[/color]


    Comment

    • Lachuh

      #3
      Re: Sound in visual basic 6.0

      Thanks for the reply, but i want to get the wav files from the adocontrol
      how do i do this? How do i get the wav files?
      "edoepke" <edoepke@comcas t.net> schreef in bericht
      news:hsidnZLJYd 8YGUaiRVn-tw@comcast.com. ..[color=blue]
      > This will get you started on how to play music files. Modify it and you
      > should be able to get close to what you want.
      >
      >
      >
      > Private WithEvents p As MediaPlayer.Med iaPlayer
      >
      > 'Place 2 Command Buttons on your form and name them "cmdPlay" and[/color]
      "cmdStop".[color=blue]
      > To control the volume, place a slider control on your form and 'set the[/color]
      Min[color=blue]
      > to -10000 (No volume) and the Max to 0 (Full Volume). Set the SelStart
      > Property to somewhere in the middle of your range. I've also 'placed a[/color]
      Label[color=blue]
      > with the caption "Volume". Now paste the following code into your project.
      >
      > Private Sub cmdPlay_Click()
      > ButtonControl
      > p.Volume = Slider1.Value
      > 'I've defined MySelection from a selected item in a listbox control
      > p.Open MySelection
      > End Sub
      >
      > Private Sub cmdStop_Click()
      > p.Stop
      > ButtonControl
      > End Sub
      >
      > Public Sub ButtonControl()
      > p.Stop
      > cmdStop.Enabled = Not cmdStop.Enabled
      > cmdPlay.Enabled = Not cmdPlay.Enabled
      > Slider1.Visible = Not Slider1.Visible
      > Label2.Visible = Not Label2.Visible
      > End Sub
      >
      > Private Sub Slider1_Scroll( )
      > p.Volume = Slider1.Value
      > End Sub
      >
      > "Jeroen van vliet" <asdasd@asdasd. nl> wrote in message
      > news:brd94f$1d4 $1@reader11.wxs .nl...[color=green]
      > > Hello all,
      > >
      > > I have an ado control with an access dbase and i want to make a button[/color]
      > that[color=green]
      > > when its clicked a specified wav or mp3 file will be played in[/color][/color]
      accordance[color=blue][color=green]
      > > with each record on the access database. Does anyone know how do do[/color][/color]
      this?[color=blue][color=green]
      > >
      > > Jeroen
      > >
      > >[/color]
      >
      >[/color]


      Comment

      Working...