Computer Learning Zone CLZ Access Excel Word Windows

What's wrong with admitting that we don't know something? Is our self-esteem so fragile?

-Carl Sagan
 
Home   Courses   TechHelp   Forums   Help   Contact   Merch   Join   Order   Logon  
 
Back to Visual Basic Forum    Comments List
Upload Images   @Reply   Bookmark    Link   Email   Next Unseen 
Code Not Running
Kevin Robertson 
          
4 years ago
I have built a fun little program that runs perfectly in the Visual Basic IDE but when I publish it there are problems.

First there was an Out Of Range Exception - now fixed.
Then the progress bar didn't work - now fixed.

The problem now is the code in the Finally section of my Try...Catch is not running.
In the screenshot I have arrowed the line I think may be the problem but I can't figure out what the actual problem is or how to solve it.

Thanks.
Kevin Robertson OP  @Reply  
          
4 years ago

Alex Hedley  @Reply  
           
4 years ago
Fart!
Alex Hedley  @Reply  
           
4 years ago
If you log the Ex in the Catch is there anything?

Can you add a Breakpoint to each section of the Try and see if it goes into any?
Richard Rost  @Reply  
          
4 years ago
Looks OK to me. I'd have to play with it.
Kevin Robertson OP  @Reply  
          
4 years ago
Yes Alex you read right - it's a Fart Machine App.

Not sure what I did but it is now partly working. The code is running but too soon. It should only run after the WAV file has stopped playing. And the progress bar has stopped working again. LOL

Still not sure why it runs perfect in Visual Studio and not when I publish it. Very weird.
I'll persevere after a well deserved break.

It is on GitHub here: https://github.com/VB1975/Fart-Machine
Richard Rost  @Reply  
          
4 years ago
I haven't done much with Visual Studio in YEARS, but I know that my VBA PlaySound code has an option to play synchronously or asynchronously. See Microsoft's site.
Kevin Robertson OP  @Reply  
          
4 years ago
I finally figured out that when I set the configuration to Release the length of the WAV file wasn't being returned (not sure why). Thanks to my old friend MessageBox for helping me out there. LOL

I hard coded the length of each, since they won't change, and it now works as it should.
Must be something to do with the function, which I found online.
Alex Hedley  @Reply  
           
4 years ago
Are you getting the length from the winapi?
Kevin Robertson OP  @Reply  
          
4 years ago
This is the function (see screenshot)

Debug gets the length
Release doesn't
Kevin Robertson OP  @Reply  
          
4 years ago

Alex Hedley  @Reply  
           
4 years ago
And there's a reference to Shell32.dll in the release build?
Kevin Robertson OP  @Reply  
          
4 years ago
Yes, as far as I know.
Alex Hedley  @Reply  
           
4 years ago
Maybe a Try/Catch and print any Exceptions to a log file?
Alex Hedley  @Reply  
           
4 years ago

This thread is now CLOSED. If you wish to comment, start a NEW discussion in Visual Basic Forum.
 

Next Unseen

 
New Feature: Comment Live View
 
 

The following is a paid advertisement
Computer Learning Zone is not responsible for any content shown or offers made by these ads.
 

Learn
 
Access - index
Excel - index
Word - index
Windows - index
PowerPoint - index
Photoshop - index
Visual Basic - index
ASP - index
Seminars
More...
Customers
 
Login
My Account
My Courses
Lost Password
Memberships
Student Databases
Change Email
Info
 
Latest News
New Releases
User Forums
Topic Glossary
Tips & Tricks
Search The Site
Code Vault
Collapse Menus
Help
 
Customer Support
Web Site Tour
FAQs
TechHelp
Consulting Services
About
 
Background
Testimonials
Jobs
Affiliate Program
Richard Rost
Free Lessons
Mailing List
PCResale.NET
Order
 
Video Tutorials
Handbooks
Memberships
Learning Connection
Idiot's Guide to Excel
Volume Discounts
Payment Info
Shipping
Terms of Sale
Contact
 
Contact Info
Support Policy
Mailing Address
Phone Number
Fax Number
Course Survey
Email Richard
[email protected]
Blog RSS Feed    YouTube Channel

LinkedIn
Copyright 2026 by Computer Learning Zone, Amicron, and Richard Rost. All Rights Reserved. Current Time: 5/9/2026 12:56:48 AM. PLT: 1s