.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

.NET Exceptions: Make the Transition from Traditional Visual Basic Error Handling to the Object-Orie

Posted By:      Posted Date: August 21, 2010    Points: 0   Category :ASP.Net

If you're used to Visual Basic 6.0 and you're making the transition to Microsoft .NET, you will find that error handling is quite different from what you've used for years. Visual Basic .NET uses a more object-oriented solution to signaling and responding to unexpected problems while your program is running. This approach, called structured exception handling, has a number of advantages over the On Error statements provided in previous versions of Visual Basic. For instance, exceptions give you lots more information about exactly what went wrong in your app. To help you take advantage of this modern error handling paradigm, this article will show you how to raise and respond to exceptions, as well as how to create your own custom exception classes.

Jesse Liberty

MSDN Magazine November 2002

View Complete Post

More Related Resource Links

Visual Basic: Inspect COM Components Using the TypeLib Information Object Library


The built-in Object Browser in Visual Basic, like other component browsers such as OLE View and XRay, is one of the more useful tools. But an even better tool would be customizable. You can build your own type library browser using the TypeLib Information Object Library (TLI), a set of COM objects designed to allow programmers to browse type libraries programmatically. This article explains type libraries and the TLI object model, and shows how to use the collections to get information about objects, leading to the creation of a custom type library explorer.

Jason Fisher

MSDN Magazine December 2000

How to make an array of class objects in Visual Basic

How can I make an array of objects in VB.net. Here is the requirement.Basically I have a class named hotel. I need to dynamically add customersto the hotel class using the Customer class. So basically if in the Hotelclass I can have an array of Customer objects that would be great. How can I do this in VB .net ? Public Class Hotel  ' I need an array of Customer objects. objCustomers End Class   Public Class Customer Private custId As Integer Private custName As String Private custAddress As String Private custCity As StringEnd Class Pseudo code:  Dim Hilton As Hotel = new Hotel()   Hilton.objCustomers(5) ' Declare an array of 5 customer objects   Hilton.objCustomers(0).CustId=1  Hilton.objCustomers(0).CustName="JoJo Smith"  Hilton.objCustomers(0).custAddress="122 Emory Lane"  Hilton.custCity="Merry More"  .  .  .  Hilton.objCustomers(4).CustId=1  Hilton.objCustomers(4).CustName="Ice Baby"  Hilton.objCustomers(4).custAddress="66 Domino Drive"  Hilton.custCity="Miami"    End While

How to make a chat program in visual basic 2008


Hi folks,

I am making a card game and i would like to make a host so that many clients can join to play, chat and share information together on a specific port or server (or whatever it is, I'm not too familiar with these)...

I would be grateful if you could provide me with some coding or anything else in vb.net to make such connection between host and many clients over the internet...

Thanks in advance.


Visual Basic 9.0 error in Visual Studio 2010


I just upgraded from Visual Studio 2005 to Visual Studio 2010 yesterday. I tried opening my site; it started the conversion wizard and seemed to work OK. However, I get the error "Visual Basic 9.0 does not support this kind of lambda expression." Here is my code:

Dim MatchLength As Integer = Url.Path.Length
                        Dim D As GetRedirectedUrlDelegate = _
          Dim NewQuerystring As QuerystringContext = Url.QuerystringContext.Clone()
          Return Url.Clone(NewPath, NewQuerystring)
        End Function

            Match = New RedirectMatch(MatchLength, d)
            Return True

The error is on the "Function()" line. I thought multi-line lambda functions were one of the new VS2010 features. Why am I getting a VB9.0 error

Visual Basic Web Browser Error


Hello Fellow Programmers! I have programmed a web browser with Visual Basic 2010 Express and came across a major bug. Whenever I try to click a checkbox on a certain website, this error message appears:

An error has occurred in the script on this page.

Line:       193

Char:      9

Code:     0

URL:       http://cdn1.weebly.com/weebly/images/common/weebly.js

              Do you want to continue running scripts on this page?

                       [Yes]                      [No]


After clicking yes or no it just pops up again and I have to open the Task Manager just to close the browser. I'm thinking that there may be an extra piece of code I must put in for JavaScript but I'm really just lost at this stage. Please, if you know something about this please let me know!

How to run Office macros by using Automation from Visual Basic .NET

This step-by-step article describes how to call Office macros from a Visual Basic .NET Automation client.

You can use Microsoft Office Automation to open a document or create a new document that contains a Visual Basic for Applications (VBA) macro and execute the macro at run time.

Dynamically Create Controls in ASP.NET with Visual Basic .NET

This step-by-step article describes how to dynamically create controls for an ASPX Web page.

The sample project does the following:
It creates two TextBox controls.
It verifies that the TextBox contents (TextBox.text) and attributes are saved across posts to the server.
It describes how events that are posted by a dynamically created control are handled.

Handling 404 page not found with Error page



      How do i handle 404 page not found?

Jscript error: Object does not support property or method


 Hi, i have little knowledge on javascript but i need to use this code get from somewhere for a jquery to work.

I face this "Jscript runtime error: Object does not support property or method" whenever im trying to run this page.

In my experience, im get this error msg 9 out of 10 times i use javascript in my system.

Im using Microsoft Visual web developer 2008, i wonder if this is related to my problem, i not sure there is anything i need to add as reference or update anything.

But anyway, in short, i just couldn't use javascript code when using this development tool because of this sort of error.

Anyway, it happen that last time i tried use the same type of jquery code in another project and it seems to work well without an error.

But now when im try to use it again in this recent project i created, it come out with this error and i have no idea how to solve it even look through google and this forum.

It doesn't really seems like its the code problem itself although im not sure, because any javascript code just couldn't work.

So below is my code that i need to use.

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js" ></script>
<script type="text/javascript" src=&quo

Error while setting up application on Win7 using Visual Studio.NET 2003


Hi All,

Getting the below error while setting up application on Win 7 using visual studio.NET 2003.


cannot find the components for communiacting with the front page server extensions...


I understand by the error, i need to install Front page server extension, but not able to figure how to install using IIS 7.5.

I had XP machine with IIS 5.1, able to find the option.


Need your help in resolving this.




Very Basic Question - Error message running first page


Hi Everyone,

I am running Windows 7 and I have gone into Control Panel and activated all of the IIS Functions.

The web application I am running was downloaded from the net (and has worked on other machines previously).  Once I downloaded it, I moved it into C:/inetpub/wwwroot/code/main.asp

I am a bit of a novice at this!  But I am hoping someone can point me in the right direction!


I get the following error when I try and run the web application through IE:

"An error occurred on the server when processing the URL. Please contact the system administrator. If you are the system administrator please click here to find out more about this error."

(When i click the "click here" button it just goes to the IIS site).


Appreciate any help I can get!




command object error


Could someone please tell me what is wrong with my syntax here?  I'd be much appreciative.


objCmd = New SQLCommand("SELECT CASE WHEN objDR('Item') = 'Enter Bill of Lading' then enterbol " _  

& "WHEN objDR('Item') = 'Bill of Lading History' THEN bolhistory " _  

& "WHEN objDR('Item') = 'Request Transfer' or objDR('Item') = 'View Transfer in Progress' THEN transfers " _  

& "END  from plantGroups where plantgroupid=@plantgroupid", objConn)

Error while using exception handling block el 4.1


Hi Folks,


i am trying to use tyhe exception handling block of Enterprise library 4.1.


I just createda polisy and used IndexOutOfRangeException and added a replace handler and a logging handler to it.

I am using the NotifyRethrow PostHandlingAction to the exception.


During runtime I am getting an exception on the HandleException event, The exception is added below:



Object reference not set to an instance of an object.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.

Source Error:

Line 42:             catch (Exception ex)
Line 43:             {
Line 44:                 bool reThrow = ExceptionPolicy.HandleException(ex, "ReplacePolicy");
Line 45:         

Registering controls of current assembly object reference NOT set error


Hi There,

I have created a simple ASP.net Web Application (2.0) and have added a web user control.

Now in my page I have added this control but I have registered like this,

<%@ Register Assembly="WebApplication1" Namespace="WebApplication1" TagPrefix="Custom" %>

Which means I want to access all the controls in my current Web Application project

Then I have added my user control like this,

<Custom:MyUserControl ID="MyUserControl1" runat="server" PublicProperty="Hello" />

Every thing is fine but when I execute the project, NO control on my user control gets "instantiated" and thus I receive error "Object Reference Not Set"

Note that My Control has,

1) Public property PublicProperty as String

2) 1 Label control

In Load Event Handler I am setting Text property of Label Control to PublicProperty. Here object reference NOT set error occurs (which means Label control is NOT initialized).

I don't want to register my control using Src, TagPrefix etc. Any ideas?


Handling external C++ exceptions


Hi. I'm working in a application that uses an external .Dll developed in C++ language. According the business rule, the .Dll can throws one exception if it found a error. My question is if it's possible handle or catch a exception throwed by the C++ dll? The try/catch doesn't works. Bellow there's the code I'm using to call the C++ dll.

        public extern static IntPtr LoadLibrary(string lpLibFileName);

        [DllImport("kernel32", CharSet = CharSet.Ansi)]
        public extern static IntPtr GetProcAddress(IntPtr hLibModule, string procName);

        public extern static bool FreeLibrary(IntPtr hLibModule);

        private delegate void DllMethodCallBack(string param1, string param2);

        public void CallDllMethod(string param1, string param2)

Basic Instincts: Multi-Targeting Visual Basic Applications in Visual Studio 2010


Visual Studio 2010 lets you create applications that target versions of the Microsoft .NET Framework from 2.0 to 4, and each step in between. We take a look at how multi-targeting works in Visual Studio today, and explain how you should approach multi-targeting in your projects.

Spotty Bowles

MSDN Magazine June 2010

Visual Basic: What's New in Visual Basic 2010


Learn about what's new in Visual Basic 10 straight from a program manager on Microsoft's Visual Basic team. Jonathan Aneja demonstrates time-saving features that help developers get more done with fewer lines of code.

Jonathan Aneja

MSDN Magazine April 2010

ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend