Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8369425
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T13:38:29+00:00 2026-06-09T13:38:29+00:00

I’m using VB 2010 Express and sometimes my code is just ignored, without any

  • 0

I’m using VB 2010 Express and sometimes my code is just ignored, without any error notification. For example, I have this code at the end of the sub that handles me.Load:

enter image description here

counter = counter is a test line. mPlayer is an object from Toub’s sound midi dll, defined like this:

Dim mPlayer As MyMediaPlayer.MyWinPlayer
mPlayer = New MyMediaPlayer.MyWinPlayer()

When the filename contains a valid midi file, it all works and the msgbox’s are displayed. When the midi file is NOT valid, I would like an error to be generated or AudioLength to be NULL or some weird value. Instead, no error is triggered and the debugger just exits the sub.

More in detail: the debugger stops at the first breakpoint. Then, when I click ‘Continue’, the form is displayed, without the debugger ever reaching the other breakpoints or ever producing the MsgBox’s.

Could you please explain how to make VB give me the error?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T13:38:31+00:00Added an answer on June 9, 2026 at 1:38 pm

    I’m not familiar with the library you are using but any exception due to an invalid file will originate from the MyWinPlayer.Open() method (function in vb-speak). So if an exception is thrown, you need to handle that exception inside of a try-catch. If your current sub does not handle the exception, then the exception will bubble up to the calling method and keep going until there is some place that the exception is handled.

    A try-catch block would be something like this (I don’t write a lot in vb.net anymore, the syntax may not be perfect):

    Try
    
        mPlayer.Open(filename);
    
    Catch ex As Exception
    
        'Do something with the exception 
        ' (e.g. write a log, set a value, or display error message)
    
    End Try
    

    Despite what I have written in the code block above, I would encourage you not to catch a general Exception, and instead focus on the specific type of exception that could be thrown from the Open() method. The reason is you only want to handle exceptions that you know how to handle in the current method and let the other exceptions bubble up. You would need to look at the documentation for the library and see what type of exceptions could be throw and include them.

    Another important thing to mention is unless you have a very good reason, do not use an empty catch block (I can’t think of one at the moment, but I’m sure there are some very rare uses). An empty catch will just swallow the exception and not do anything with it. It won’t even notify you that there was an exception.

    Now if you don’t handle any exception, the exception should bubble up all the way to the top of the call stack and the debugger should show an Unhandled Exception message and stop there. If it is not doing that then either you are swallowing the exception further down the call stack or you are running into the bug that is mentioned in the possible duplicate Hans Passant mentioned in his comment

    MSDN has a pretty decent summary of exception handling in the .NET languages. I would encourage you to read more on the subject.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I have this code to decode numeric html entities to the UTF8 equivalent character.
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
I have a .ini file as follows: [playlist] numberofentries=2 File1=http://87.230.82.17:80 Title1=(#1 - 365/1400) Example
I have just tried to save a simple *.rtf file with some websites and
this is what i have right now Drawing an RSS feed into the php,
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I have thousands of HTML files to process using Groovy/Java and I need to
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
That's pretty much it. I'm using Nokogiri to scrape a web page what has

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.