Way To Predict Exceptions And Errors For Detailed Exception And Error Management?
Nov 19, 2011
on the msdn pages describing classes etc, there are a lot of properties and methods mentioned from classes. But is there a kind of property of a class or method which gives te collection of expected errors ?i ask this because in the try catch statement you can specify the exceptions and errors you want to catch, but
Good, detailed resources or books for best-practices on exception handling? I am looking to dive into a much deeper understanding of it, and am finding it hard. All the books I see over .NET, ASP.NET, etc. place little emphasis or detail on exception handling.
I am currently testing out a 3-tier ASP.NET application, with a presentation layer, business logic layer, and data layer, and want to know more about exactly when to throw errors, when to catch them, what layer to do them in, etc.
I don't want a simple google search on ".NET exception handling" and then having you post the first couple of links. I would like you to respond if you have quality, known resources that you have used or have found.
I have already incorporated DirectX into a program and set the owner to a picturebox which so far works great, but all it does is set the place/dimensions of the directx window to the picturebox... it doesn't actually USE the picturebox for the video so if i pause the video or set a timeframe I can't use the picturebox frame/image to pull information from. So what I want to do is when i pause the video at a certain frame I want to be able to actually take a snapshot and populate the picturebox with that image and then be able to save/manipulate it like a normal picture. I have read some examples and coding on screen snapshots using DirectX.3D, but not audiovideo. Not sure if its the same or what. I know normally you would start out with CODE, but in this case I have NO IDEA exactly where or how to start it.. I tried Bitmap options with the screen area/location, etc... but was getting errors and exceptions..
Is there a way I can catch and handle two different exceptions within the same exception type? For example:
Try ' My code Catch ex As System.Net.WebException End Try
I have 2 different exceptions that are System.Net.WebException. I want to handle them different ways. Problem is the catch block above catches them both. Is there a way I can determine if which of the two it is and handle them differently?
Notice the catch (Type) instead of catch (Type myVariable). Is this possible with VB.NET, or do you always have to declare a variable when you catch exception types, like so:
Is the only way to create custom exceptions to inherit from System.Exception?
I wish to create a class that can be thrown as an exception but i do not wish to inherit from System.Exception because i have a base [Object] class in my library which all my classes should inherit from and i wish my custom exception class could also inherit from it.
I have a large project where we have 2-3 dll projects that are converted from VB6 to VB.NET. We have fixed all the issues that caused compilation errors, and most of obvious issues in running, so now we have basically a program up and running. The exe is created from scratch in VB.NET, using a lot of functionality from the converted dll's (including GUI forms). What I wonder is when I run the program in debug mode, I get a bunch of warnings in the "Immediate Window" saying:
A first chance exception of type 'System.Exception' occurred in Microsoft.VisualBasic.dll
...and some of other type (but most of them in Microsoft.VisualBasic.dll).I was wondering if this is common in projects converted from VB6, or if it is caused by bad design in our code...
I've just skipped around a few inbuilt VB classes' methods which throws exception. of all that i've came across, methods may throw multiple exceptions but ALL of them are exclusive, meaning there is no way 2 exceptions will ever occur simultaneously, yea and i was trying to make my class throw 2 exceptions simultaneously, hence this question, must all exceptions be exclusive?
Create an application that will predict the approximate size of a population organisms. The user should select or enter the starting number of organisms in a combo box, enter the average daily population increase (as a percentage) in a text box and select or enter the number of days the organisms will be left to multiply in another combo box. For example, assume the user enters the following values:
Starting number of organisms: 2 Average daily increase: 30% Number of days to multiply 10
The application should display th following table of data.Day Approximate Population 1 2 2 2.6 (table should list values up to 10 days)
Be sure to add appropriate ToolTips for each control on the form.Input validation: Do not accept a number less than 2 for the starting size of the population. Do not accept a negative number for the average daily population increase. Do not accept a number less than 1 for the number of days the organisms will multiply.
I recently upgraded a project from 2003 to 2005, and there were errors in them, but I am unable to view any in the error list. Only one error displays in the list
When two computers are connected through TCP, and one of them closes and breaks the connection, it throws error 10054 "Remote host forcibly closed the connection".I want to handle this error because I know it will happen more often than not with the application I'm building. In System.Net.Sockets.SocketException, there is an on the error code. But when I run the program, the exception that is being thrown is System.IO.IOException, and the GetType for IOException is the socket exception. I don't know how to handle the socket exception if it's not the root cause of the exception.
Here is the code for my Try Catch block: For infiniteCounter = 1 To 2 infiniteCounter = 1
I never got into detailed error processing too much when I played in VBA/VB6 a lot. Mostly then, if you ran into a user error (such as some input of theirs failing a validation test of some kind), you popped a MsgBox() with some error information and the critical (or warning) icon, and safely aborted out of the code
In .NET, my reading basically points to exceptions as the end-all in error handling. It looks to me that if you know a spot of code where a user can screw up, you're supposed to catch it with either try...catch blocks (for things like data conversions), or standard if...the...else constructs for other things, and then throw a new exception if needed.
Isn't throwing an exception essentially a forced crash of a program in a sense (granted, you get the option of continuing)? Or are exceptions geared specifically for things like data conversion errors and other "things that shouldn't happen", and resume use of MsgBox() and friends for minor user screwups?
Consider the case of where you have a TextBox that is only supposed to accept numeric data (or heck, just a specific set of characters). Barring some other trick that lets you restrict that field (let's just assume it's freeform, programatically), it would seem a bit of a waste to throw new exceptions everytime they type in an invalid character, or even if the error checking doesn't happen until they press a submit button (like on a webpage). Popping a MsgBox() seems more sane in that case.
So what's the straight dope on exceptions and throwing new ones on user errors? How about if your program also exposes a programmatic framework? Bad usage of one of the programmatic functions definitely seems like new exception territory to me.
I have a project that reference from leadtools 16.5, and after that, i want to run my project..i see am error like it " An error occurred creating the form. See Exception.InnerException for details. The error is: Attempted to read or write protected memory. This is often an indication that other memory is corrupt. im using vb 2008 pro
I use visual basic 2010 professional edition. I am working on a project on it with access on the backhand. i want to view the data in datagrid control for the stock management. I also want to setup a query in the query builder which will search the database according to the ID but i cant get it right i dont know why. i type in the form filter this: LIKE @ID + '%'. But when i click somewhere else, an error appears which says: Data type error in expression.
I am using VB.NET 2005 to create a Windows forms application. I have a procedure named SendMail that creates an instance of Outlook.Application, to send an email from my application. I found the code on this forum, I think.The procedure works fine, but I can't use error handling with it.I call the procedure from a button click event. I put the procedure call in a try/catch block, and the application won't build, with the following error.
Error 68 'Catch' cannot catch type 'Microsoft.Office.Interop.Outlook.Exception' because it is not 'System.Exception' or a class that inherits from 'System.Exception'. C:datadevdmtiQTSQTSv7_1_20100212wQTSQTSReportsCriteria pt_frmReportViewer.vb 43 21 QTS
Here is the code:
Sub SendMail(ByVal sFile As String) ' Create an Outlook application. Dim oApp As Outlook._Application
Using MS Visual Studio 2010 Express, when trying to debug, the build finishes and the following error below appears. It doesn't seem to effect the running of the program.
The error is:
An exception was encountered while constructing the content of this frame. This information is also logged by running the application with the /log parameter on the command line, which stores results in "C:Documents and SettingsCorkyApplication DataMicrosoftVBExpress10.0ActivityLog.xml".
Exception details:
System.Runtime.InteropServices.COMException (0x80040154): Class not registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG))[code].....
I can't find the "ActivityLog.xml" file the message references.
I was scripting a very basic process manager, with a ListView component, and it was working fine for many days, up until now.Here is the code for getting processes:
Dim Process As New Process() Dim Count As Integer = 0 ListView1.Items.Clear()[code].....
The line of code where I put "*WIN32 EXCEPTION LINE* keeps running into an error(Win32 Exception was unhandled; Access is denied). Here is the full error description:
System.ComponentModel.Win32Exception was unhandled ErrorCode=-2147467259 Message=Access is denied[code]....
As I said before, this had been working for several days, up until now.
I am coding in vb.net. I migrate a project from vb6 to vb.net.In my migrated project I'm pretty sure there are close to 200 errors.but in ErrorList it show only 102 error. So, my question is how can i get all errors at a time in Error List.
I imported an app from vb6 to vb.net It works fine. It has one axmsflexgrid control. Now I want to add another axmsflexgrid control in the same app. I tried to copy and paste from one frame (groupbox) to another and got this error:
"An error occurred while processing this command: Exception from HRESULT:0x800A018A (CTL_E_GETNOTSUPPORTED)"
An inputs on how would I fix this? Or just make a new axmsflexgrid?
ok so i viewed some other question that are ruffly the same and i am still confused, here is the stacktrace
at Game3.My.MyProject.MyForms.Create__Instance__[T](T Instance) in 17d14f5c-a337-4978-8281-53493378c1071.vb:line 190 at Game3.My.MyProject.MyForms.get_Character_Creator() at Game3.My.MyApplication.OnCreateMainForm() in C:UsersMasonDocumentsVisual Studio 2010ProjectsGame3Game3My ProjectApplication.Designer.vb:line 35
[Code]...
also, where is game3.my.myproject, obviously its a line of code but what is it in.
i have been designing a library management system in vb and i get no errors vi the ide but when i run the programm i get an exception error i wud like to kno if i could upload my solutions n u guys have a look thriugh 4 me as i have run through it with my group member and we can't find the problem i keep getting this error {"Disk or network error."} when its supposed to carry out an instruction regarding the database
I'm using Try/Catch blocks for a program calculating payroll and commission. I've dim'd my variables, and I've parsed them inside my Try/Catch blocks. It appears as if my Try/Catch blocks have been coded correctly. However when in run-time, my format exceptions will show regardless if I provided a correct input.[code]Is there an issue with my programming? Or could there be a property I'm over-looking for my text boxes? I'm stuck.
im developing an application with an error log, when something goes bad, it must send through mail the error details so i can remotely fix and upload a new update with the fix.Im using Try Catch Exception but i have a lot of methods to include this option in, is there another way to do it without doing so much code?