VB.NET mciSendString Volume Error 261

I am using the following code

  Public Sub PlayWavFile(ByVal WavFilePath As String)
        Dim cmd As String = "open " & Chr(34) & WavFilePath & Chr(34) & " type waveaudio alias mywav"
        If mciSendString(cmd, Nothing, 0, IntPtr.Zero) = 0 Then
            MsgBox(mciSendString("setaudio mywav volume to " + Volume.Value.ToString, Nothing, 0, 0))
            Button1.Text = "Stop"
            mciSendString("play mywav notify", Nothing, 0, Me.Handle)
            MessageBox.Show(WavFilePath, "Error Loading Wav", MessageBoxButtons.OK, MessageBoxIcon.Error)
        End If
    End Sub

Open in new window

I get an error 261 and no volume change.  Not knowing a lot about this, I also tried

mciSendString("setaudio mywav volume to " + Volume.Value.ToString, Nothing, 0, me.Handle)

Open in new window

Volume is a value from a trackball with minimum set to 1 and maximum set to 1000.  If I look at the statement, it says "setaudio mywav volume to 300".

Everything else works and this is pretty common statement, but for some reason can not get it to work.  

Any suggestions?

Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Randy PooleCommented:
Try this:
MsgBox(mciSendString("setaudio mywav volume to " & Volume.Value.ToString,vbNullString, 0, 0))

Open in new window


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic.NET

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.