473,654 Members | 3,239 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 1648
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******* ******@cpmsftng xa07.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 misunderstandin g. 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=JavaSc ript>

function errorHandler(me ssage, 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
9538
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 error, my handler does not get hit - I get the standard ugly run time error. The strange thing is, I tried the exact same code in a new, windows forms application, and when I trigger an unhandled exception, the code works fine (the JIT compiler...
9
1196
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 their handling capabilities. I have replace the handling clauses but nothing happens (not totally correct - some dropdowns are populated) and there is no way to debug. Putting breakpoints where the dropdowns are populated result in nothing...
2
2066
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 seconds to load this control into the page. CPU usage is at only 1% to 2% during the 12 sec All of this is on a single machine XP Pro sp1 (all critical updates loaded) 2.6GHz, P4, 512MB ra IE v6.0.2800.1106.xpsp2.030422-1633 IIS 5.1 ..net...
12
2785
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 when menu items are clicked.Besides these i would like to put a custom status bar. Any error message encountered in any of the webpage will be displayed in the banner. The problem iam encountering is how to access the customer status bar in child...
4
9836
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, but it seems like a workaround. I'm not sure if it's the best way: Dim ErrorCounter As Integer Private Sub btnOK_Click(ByVal sender As System.Object, ByVal e As
2
1568
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. Where _stepResizeRelocator is an instance (class level) variable. There is no compiler error on the declaration of the variable, only on use. Tthe name of the variable which causes the error changes.
3
302
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 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...
1
8542
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 Me.ReportViewer1.ServerReport.ReportPath = "/myproject/DemandeDeCotation" Me.ReportViewer1.ServerReport.ReportServerUrl = New System.Uri("http://myserver/reportserver2005", System.UriKind.Absolute)
6
11429
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, among others). Sometimes that code includes retrieving information from a database. Now that I'm doing this in C# 2005, I realized that I can put that code either in Form load event or in the constructor of the form after the...
0
8379
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8816
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8709
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8494
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
6162
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5627
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4297
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2719
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1924
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.