R
RobP
Hi,
I thought I knew how error handling with Try, Catch worked and have
used it before but now I'm stuck on it, and even the most basic thing
isn't working how I expected it too which makes me question if I
understand it at all. I just did this little example:
------------------------------------------------------------
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://
www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@ Page Language="VB" %>
<script runat="server">
sub page_init(Src as Object, E as EventArgs)
Try
strTest = "hello"
Catch
response.write("strTest is an undeclared variable")
End Try
end sub
</script>
<html dir="ltr" xmlns="http://www.w3.org/1999/xhtml">
<body>
<form id="form1" runat="server">
</form>
</body>
------------------------------------------------------------
When I compile that, I expect to get a blank page saying "strTest is
an undeclared variable" as the code under Catch tells it to, but
instead I get a page compilation error - BC30451: Name 'strTest' is
not declared. Can anyone see why my error trapping doesn't work?
Thanks in advance for any ideas
Rob
I thought I knew how error handling with Try, Catch worked and have
used it before but now I'm stuck on it, and even the most basic thing
isn't working how I expected it too which makes me question if I
understand it at all. I just did this little example:
------------------------------------------------------------
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://
www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@ Page Language="VB" %>
<script runat="server">
sub page_init(Src as Object, E as EventArgs)
Try
strTest = "hello"
Catch
response.write("strTest is an undeclared variable")
End Try
end sub
</script>
<html dir="ltr" xmlns="http://www.w3.org/1999/xhtml">
<body>
<form id="form1" runat="server">
</form>
</body>
------------------------------------------------------------
When I compile that, I expect to get a blank page saying "strTest is
an undeclared variable" as the code under Catch tells it to, but
instead I get a page compilation error - BC30451: Name 'strTest' is
not declared. Can anyone see why my error trapping doesn't work?
Thanks in advance for any ideas
Rob