473,320 Members | 1,951 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Cleanly handling load errors when using WinForms controls in IE

I've embedded a .NET 1.1 control in a web page for use in IE (using
the "object" tag). There are two challenges I'm facing: if the
machine does not have the 1.1 framework installed or if the .NET
security does not allow the control to initialize the user is faced
with a big blank area and won't know what to do about it.

How would I go about redirecting the user to a help page only if the
control can't initialize? Or are there alternate approaches someone
can recommend?

Thanks.
Jul 21 '05 #1
3 1631
Hi,

Thanks for your post.
How would I go about redirecting the user to a help page only if the

control can't initialize?
I believe that it's a good idea. If it fails to create the control, you can
call the following code to redirect the web page:

window.navigate("error.htm");

Please feel free to let me know if you have any problems or concerns.

Have a nice day!

Regards,

HuangTM
Microsoft Online Partner Support
MCSE/MCSD

Get Secure! -- www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

Jul 21 '05 #2
ti******@online.microsoft.com (Tian Min Huang) wrote in message news:<hh*************@cpmsftngxa07.phx.gbl>...
Hi,

Thanks for your post.
How would I go about redirecting the user to a help page only if the

control can't initialize?
I believe that it's a good idea. If it fails to create the control, you can
call the following code to redirect the web page:

window.navigate("error.htm");


The challenge I was facing was not how to redirect, but how to trap
the fact that the WinForms control is not properly initialized.

The pure HTML approach (which will fall back to nested HTML or a
nested object tag if the outer object can't be initialized) doesn't
work. Trying to use JavaScript with the object element's "onerror"
callback doesn't work.

In the interim I discovered the answer: Trigger some JavaScript to
fire "onload" of the page. In that JavaScript code, check whether a
property of the control has a value you expect it to have. If not,
the control has not initialized properly.
Jul 21 '05 #3
Hello,

Sorry for the misunderstanding. I suggest you to add window.onerror handler
for all script errors that occur anywhere on a Web page. It looks like this:

...
<SCRIPT language=JavaScript>

function errorHandler(message, url, line)
{
// message == text-based error description
// url == url which exhibited the script error
// line == the line number being executed when the error occurred

// handle the error here

// stop the event from bubbling up to the default window.onerror handler
// (see the "For More Info" section for an article on event bubbling)
return true;
}

// install the global error-handler
window.onerror = errorHandler;
</SCRIPT>

Please refer to the following MSDN article for detailed information:

Handling and Avoiding Web Page Errors Part 2: Run-Time Errors
http://msdn.microsoft.com/library/de...us/dnscrpt/htm
l/WebErrors2.asp

Hope this helps.

Regards,

HuangTM
Microsoft Online Partner Support
MCSE/MCSD

Get Secure! -- www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

Jul 21 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Steph | last post by:
I am working on a Windows Forms App. I have attached a standard UnhandledExceptionEventHandler to the current domain to catch unexpected errors. In my application, when I trigger an unhandled...
9
by: Lloyd Sheen | last post by:
In an attempt to reformat the web page I moved controls into a frame and then when that did no good I replaced then on the aspx in the same order as before. When I did the CTL-X the handlers lost...
2
by: John Alesse | last post by:
Hi, I've created a very simple winforms control using the c# wizard in VS .net 2003 that is nothing but a System.Windows.Forms.UserControl. There are no other controls on the form It takes IE 12...
12
by: scsharma | last post by:
Hi, I am working on creating a webapplication and my design calls for creating main webform which will have menu bar on left hand side and a IFrame which will contain all the forms that are shown...
4
by: johnb41 | last post by:
I have a form with a bunch of textboxes. Each text box gets validated with the ErrorProvider. I want the form to process something ONLY when all the textboxes are valid. I found a solution,...
2
by: Samuel R. Neff | last post by:
Within the past few weeks we've been getting a lot of compiler errors in two classes when no errors actually exist. The error always reports as Name '_stepResizeRelocator' is not declared. ...
3
by: Dan Foody | last post by:
I've embedded a .NET 1.1 control in a web page for use in IE (using the "object" tag). There are two challenges I'm facing: if the machine does not have the 1.1 framework installed or if the .NET...
1
by: Pieter | last post by:
Hi, In my application VB.NET 2005 application I placed a ReportViewer, and link it to a server-report: Me.ReportViewer1.ProcessingMode = Microsoft.Reporting.WinForms.ProcessingMode.Remote...
6
by: Rolandpish | last post by:
Hi there. I'm doing an application in C# 2005. I was used in VB6 to put code in Forms load event in order to initialize some values of the controls (grid values, text boxes values, label captions,...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.