This works for me :
My.Computer.Audio.Play(My.Resources.alpha, AudioPlayMode.WaitToComplete)
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
I am trying to access wav files embedded in a resource file. I am using Visual studio community (visual basic)
here is the code:
Public Class Form1
Sub PlayBackgroundSoundResource1()
My.Computer.Audio.Play(My.Resourse1.resx.alpha.wav,
AudioPlayMode.WaitToComplete)
End Sub
here is the solution explorer:
I am getting the following error message:
BC30456 ‘alpha’ is not a member of ‘morse_code.My.Resources’.
Can you please help me with this or point me in the right direction.
Thanks,
Mike Benton
This works for me :
My.Computer.Audio.Play(My.Resources.alpha, AudioPlayMode.WaitToComplete)
My.Computer.Audio.Play(My.Resources.alpha, AudioPlayMode.WaitToComplete)
This is what I get with that change except the red underline is on My.Resources.alpha not AudioPlayMode.WaitToComplete and I still have the same error message.
I'm not sure why it shows a different underline when I paste it here.
Yes the resource has been added. I am using visual studio 2019 community and windows 10 64 bit.
Hi @Mike Benton ,
Remove 'Resource1' folder and try adding wav files again.
Right Click your project -> 'Properties' -> 'Resources' -> 'Add Resource' ...
Then use:
My.Computer.Audio.Play(My.Resources.alpha, AudioPlayMode.WaitToComplete)
Best Regards,
Xingyu Zhao
*
If the answer is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.
I finally got this to work by deleting the resources and creating a new resource file as follows:
Projects - morse code properties - and then selecting the resource tab on the left and adding the
resources again.
There are several other ways to add a resource file but this is the one that worked for me.
Thanks to all who were trying there best to help me figure this out.
Mike Benton