|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
VS2005 Exception HandlingI understand how an exception handling occurs using try/catch when a single
statement or a block of statements are being executed. How do you handle exceptions when you have managed code. For instance, you have databound control and you need to catch a particular condition. How do you handle that? Thanks in advance Your second and third sentences seem to contridict the first?
Try Catch Finally is a structured exception handling construct particular to managed code. So i dont know what you mean by >How do you handle For instance, you have databound> exceptions when you have managed code. " > control and you need to catch a particular condition. It depends if by condition you mean event or exception? If the controlitself is throwing an undocumented exception then you have a bug on your hands. If it is throwing a documented exception then you wrap the method of the control that might throw the exception in a try catch block specifically set up to catch an exception of that type. If by condition you meant event then you handle the event. tm Show quoteHide quote "RG" <nob***@nowhere.com> wrote in message news:uEWKS1PJGHA.3504@TK2MSFTNGP10.phx.gbl... > I understand how an exception handling occurs using try/catch when a single > statement or a block of statements are being executed. How do you handle > exceptions when you have managed code. For instance, you have databound > control and you need to catch a particular condition. How do you handle > that? > > Thanks in advance > > Thanks for your time and help.
I am talking about exception. Specifically, the framework was coming up with exception when I would for instance use control incorrectly or have datatype mismatch on databound controls. Considering that databound controls are dropped into the application, how do you catch the exception? as I am not writting a line of code. In other words, I am not supplying that code. In fact, it appears that any code that vb generates should left untouched as it would overlay the changes on subsequent compiles. Thanks again Show quoteHide quote "Toff McGowen" <t*@toff.com> wrote in message news:OfGlZrUJGHA.524@TK2MSFTNGP09.phx.gbl... > Your second and third sentences seem to contridict the first? > > Try Catch Finally is a structured exception handling construct particular > to > managed code. So i dont know what you mean by > >>How do you handle >> exceptions when you have managed code. " > > For instance, you have databound >> control and you need to catch a particular condition. > > It depends if by condition you mean event or exception? If the control > itself is throwing an undocumented exception then you have a bug on your > hands. > If it is throwing a documented exception then you wrap the method of the > control that might throw the exception in a try catch block specifically > set > up to catch an exception of that type. > > If by condition you meant event then you handle the event. > > tm > > > > "RG" <nob***@nowhere.com> wrote in message > news:uEWKS1PJGHA.3504@TK2MSFTNGP10.phx.gbl... >> I understand how an exception handling occurs using try/catch when a > single >> statement or a block of statements are being executed. How do you handle >> exceptions when you have managed code. For instance, you have databound >> control and you need to catch a particular condition. How do you handle >> that? >> >> Thanks in advance >> >> > > In order to catch bubbled up exceptions lookup
AddHandler Application.ThreadException ... Put that in your Sub Main... though I would wrap it in a #IF DEBUG conditional because during debugging it'll get in your way. Show quoteHide quote "RG" <nob***@nowhere.com> wrote in message news:%23fecK7UJGHA.984@tk2msftngp13.phx.gbl... > Thanks for your time and help. > > I am talking about exception. Specifically, the framework was coming up > with exception when I would for instance use control incorrectly or have > datatype mismatch on databound controls. Considering that databound > controls are dropped into the application, how do you catch the > exception? as I am not writting a line of code. > In other words, I am not supplying that code. In fact, it appears that > any code that vb generates should left untouched as it would overlay the > changes on subsequent compiles. > > Thanks again > "Toff McGowen" <t*@toff.com> wrote in message > news:OfGlZrUJGHA.524@TK2MSFTNGP09.phx.gbl... >> Your second and third sentences seem to contridict the first? >> >> Try Catch Finally is a structured exception handling construct particular >> to >> managed code. So i dont know what you mean by >> >>>How do you handle >>> exceptions when you have managed code. " >> >> For instance, you have databound >>> control and you need to catch a particular condition. >> >> It depends if by condition you mean event or exception? If the control >> itself is throwing an undocumented exception then you have a bug on your >> hands. >> If it is throwing a documented exception then you wrap the method of the >> control that might throw the exception in a try catch block specifically >> set >> up to catch an exception of that type. >> >> If by condition you meant event then you handle the event. >> >> tm >> >> >> >> "RG" <nob***@nowhere.com> wrote in message >> news:uEWKS1PJGHA.3504@TK2MSFTNGP10.phx.gbl... >>> I understand how an exception handling occurs using try/catch when a >> single >>> statement or a block of statements are being executed. How do you >>> handle >>> exceptions when you have managed code. For instance, you have databound >>> control and you need to catch a particular condition. How do you handle >>> that? >>> >>> Thanks in advance >>> >>> >> >> > > |
|||||||||||||||||||||||