comparing date values

pjfatboy

Active member
Joined
Nov 30, 2012
Messages
35
Programming Experience
Beginner
I am new to .net and I found this code several times in a Google search. Could someone please tell me why this code is not working? I checked several times and the file is in this location. Sorry, the wav file is not playing. Also could someone tell me how to place code in a Thread? DimappPathAsString = Application.StartupPath()
IfAlarmtxt.Text <> ""Then
IfCDate(Datelb.Text) = AlarmDTP.ValueAndTimelb.Text = Alarmtxt.TextThen
My.Computer.Audio.Play(appPath & "\Alarm2.wav", AudioPlayMode.Background)
EndIf
EndIf
 
Last edited:
Yeah I tried that and it didn't work either. I'll try it again. Nope didn't work either. For the life of me I can't figure this one out. Code is right, the file is there, the volume is up and the line of code is read but no go. I don't know what else to try.

You must've done something differently, because If you added it as a resource, I don't know why that wouldn't work. You added it as an audio resource?
 
Yes I did. I don't know what to say. I've done everything you have suggested but it still doesn't work.
 
Last edited:
Yes I did. I don't know what to say. I've done everything you have suggested but it still doesn't work.

Okay, just so I can double check, can you explain in steps what you did exactly to add this wav file as a Resource? And is it possible for you to provide me with your full code? It seems the suggestions above aren't working, so we're missing something somehow, and that calls for backtracking to get a bigger picture of your setup.
 
Ok, I clicked Project on the menu then click the project properties. Next I click the Resources tab then chose Audio from the file type drop down arrow. Then I clicked add Existing File from the Add Resource drop down arrow. Then I navigated to the file and clicked the file and then clicked the Open button to add the file. Then the Windows Media file icon showed up in the file list box and the wav file appeared under Resources in the Solution Explorer. Not sure how to attach a zipped file, I don't see an attachment button.
 
Ok, I clicked Project on the menu then click the project properties. Next I click the Resources tab then chose Audio from the file type drop down arrow. Then I clicked add Existing File from the Add Resource drop down arrow. Then I navigated to the file and clicked the file and then clicked the Open button to add the file. Then the Windows Media file icon showed up in the file list box and the wav file appeared under Resources in the Solution Explorer. Not sure how to attach a zipped file, I don't see an attachment button.

Hmm, perhaps it could be the wav file itself? I would suggest testing a new wav file to help narrow down the list of possible problems. Right now, I can't think of why it wouldn't be playing... Try having your Playback devices window open, and then try having the program play the resource while in debug mode and see if any sound is detected by any of your playback devices; look for the sound meter to show some color. I'm curious if it's trying to play the sound on any device on your system.

(To add a zip file though you're going to have to add it as a file resource. Then when you want to unzip the data, you're going to have to deal with the byte array yourself.)

Sorry I haven't come up with any solutions so far, this is just odd. Unless I'm missing something which is right in front of my eyes here, I'm pretty puzzled.
 
As I mentioned before I can double click the file in the Resource folder and it plays fine, how ever I did play the file with another media device and it still plays fine. I also imported another wav file and tried it but get the same result. I'm not trying to add a zipped file to the Resource, I was going to attach my app to this post so that you could test if on your machine for me.
 
If you can do that, it may help as well. I'd like to see how you've got everything set up, and perhaps I can see something wrong at that time...
 
Ok, I just put this project onto my laptop and run the app and it worked fine. So why in the @#$% does it not work on my desktop? Like I said I am able to play the file by double clicking the file in Resource folder and I can open the file with Windows Media Player or Winamp and it plays fine. What the heck.
 
If it worked on your laptop then this is not a programming issue, and moreso the configuration you have for your desktop sound. There's something a bit off with your sound settings if no error shows when you debug and you can run things on your laptop fine.
 
You have Windows 8 correct? Do you have any suggestions where to start looking for the problem? I have Windows 8 on my Laptop also and worked fine on it.
 
I am using Windows 8 right now yes.

- Control Panel > Sound
- As well as right clicking on the sound icon in your notification area and choosing PlayBack devices
- Perhaps check your Event viewer as well for any errors.
 
Oh my gosh. I right clicked on the speaker on my taskbar and Clicked the Volume Control Options from the menu and neither the Digital Output or the speakers checkboxes was checked. I clicked the Speakers / Headphones check box and now it works fine. I don't understand how I could play the file with Windows Media Player before and it played fine. Anyway, I sure appreciate all of your help. This has been such a pain. Now if I can just figure out how to change the Desktop Wallpaper through my app I will be all done. Is this possible?
 
It is possible. I believe this can be done through WMI? I had a PowerShell script that did this... But this is just off the top of my head. There is most probably also a way around WMI to do this as well.
 
I've done a search on the subject but I was unable to get any of the sample codes I found to work. Would you mind showing my your PowerShell script?
 
I've done a search on the subject but I was unable to get any of the sample codes I found to work. Would you mind showing my your PowerShell script?

The powershell script was in the MSDN archives I believe. Here was a script by a Microsoft Employee:
VB.NET:
Function Set-WallPaper($Value)

{

 Set-ItemProperty -path 'HKCU:\Control Panel\Desktop\' -name wallpaper -value $value

 rundll32.exe user32.dll, UpdatePerUserSystemParameters

}
 
Back
Top