Hello everyone, i need a bit of help.
On a click of a button i want to pay an audio file.... here is my code


Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
If TextBox2.Text = "1" Then
TextBox2.BackColor = Color.LawnGreen
C:\Users\Nick\Desktop\good_work.play

now for some reason it says syntax error? help me!!!

First, your If statement needs a closing End If statement.

If TextBox2.Text = "1" Then
            TextBox2.BackColor = Color.LawnGreen
            'C:\Users\Nick\Desktop\good_work.play
        End If

Second, you cannot just paste a file's full path, especially one without a file extension and expect nothing but errors.
You have to declare it.

Dim myCoolFile As String = "C:\Users\Nick\Desktop\good_work.wav"

And finally, check out this thread.
How do I make a program in VB make a sound when it starts?

Hello everyone, i need a bit of help.
On a click of a button i want to pay an audio file.... here is my code


Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
If TextBox2.Text = "1" Then
TextBox2.BackColor = Color.LawnGreen
C:\Users\Nick\Desktop\good_work.play

now for some reason it says syntax error? help me!!!

If you are try to play the audio player with windows media player then you need the code to start the player which is a system process.
Here is the code to start the windows media player
System.Diagnostics.Process.Start("wmplayer.exe")

Codeorder, thanks..... post something in reply and then i will mark the thread as solved

:yawn:

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.