Chat LIVE With Programming Experts! There Are 23 Online Right Now...

Welcome to Dream.In.Code
Become a VB.NET Expert!

Join 244,310 VB.NET Programmers for FREE! Get instant access to thousands of VB.NET experts, tutorials, code snippets, and more! There are 866 people online right now. Registration is fast and FREE... Join Now!




Help on how to put correct URL in accessing a file

 
Reply to this topicStart new topic

Help on how to put correct URL in accessing a file

kalabidong
23 Aug, 2008 - 09:16 AM
Post #1

New D.I.C Head
*

Joined: 23 Aug, 2008
Posts: 7

I'm a noob in visual basic and I'm trying to make a project that makes a sound if you press a key. But the problem is, when I build it and put the .exe file into another pc, there is no sound playing. But if I debug it, it is working perfectly. Now, the question is: how do I put the correct URL in accessing a file?

here is my code:
CODE

    Private Sub Form1_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles Me.KeyDown
        Select Case e.KeyCode
        Case Keys.Z
                AxWindowsMediaPlayer1.URL = "C:\Documents and Settings\Administrator\My Documents\Visual Studio 2008\Projects\drum wavs\tom\1 mid tom.wav"
         Case Keys.X
                AxWindowsMediaPlayer12.URL = "C:\Documents and Settings\Administrator\My Documents\Visual Studio 2008\Projects\drum wavs\tom\2 mid tom.wav"
         End Select
    End Sub


Thank You..

User is offlineProfile CardPM
+Quote Post


gbertoli3
RE: Help On How To Put Correct URL In Accessing A File
23 Aug, 2008 - 09:41 AM
Post #2

DIC at Heart + Code
Group Icon

Joined: 23 Jun, 2008
Posts: 1,079



Thanked: 23 times
Dream Kudos: 950
My Contributions
QUOTE(kalabidong @ 23 Aug, 2008 - 10:16 AM) *

I'm a noob in visual basic and I'm trying to make a project that makes a sound if you press a key. But the problem is, when I build it and put the .exe file into another pc, there is no sound playing. But if I debug it, it is working perfectly. Now, the question is: how do I put the correct URL in accessing a file?

here is my code:
CODE

    Private Sub Form1_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles Me.KeyDown
        Select Case e.KeyCode
        Case Keys.Z
                AxWindowsMediaPlayer1.URL = "C:\Documents and Settings\Administrator\My Documents\Visual Studio 2008\Projects\drum wavs\tom\1 mid tom.wav"
         Case Keys.X
                AxWindowsMediaPlayer12.URL = "C:\Documents and Settings\Administrator\My Documents\Visual Studio 2008\Projects\drum wavs\tom\2 mid tom.wav"
         End Select
    End Sub


Thank You..


Your answer is simple.

All you have to do is change
CODE

    Private Sub Form1_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles Me.KeyDown
        Select Case e.KeyCode
        Case Keys.Z
                AxWindowsMediaPlayer1.URL = "C:\Documents and Settings\Administrator\My Documents\Visual Studio 2008\Projects\drum wavs\tom\1 mid tom.wav"
         Case Keys.X
                AxWindowsMediaPlayer12.URL = "C:\Documents and Settings\Administrator\My Documents\Visual Studio 2008\Projects\drum wavs\tom\2 mid tom.wav"
         End Select
    End Sub


to

CODE

    Private Sub Form1_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles Me.KeyDown
        Select Case e.KeyCode
        Case Keys.Z
                AxWindowsMediaPlayer1.URL = "http://www.yoursite.com/Sounds/1 mid tom.wav"
         Case Keys.X
                AxWindowsMediaPlayer12.URL = "http://www.yoursite.com/Sounds/2 mid tom.wav"
         End Select
    End Sub


Let me explain

The directory and file you are trying to find isn't on the user's computer. If it was then you could play it.

Hope this helps
User is offlineProfile CardPM
+Quote Post

kalabidong
RE: Help On How To Put Correct URL In Accessing A File
25 Aug, 2008 - 06:55 AM
Post #3

New D.I.C Head
*

Joined: 23 Aug, 2008
Posts: 7

thanks for the help..


User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic

Time is now: 7/4/09 07:28PM

Live VB.NET Help!

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter Fan Us On Facebook

VB.NET Tutorials

Reference Sheets

VB.NET Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month