473,513 Members | 2,406 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

AddHandler Causes Exception

Hi All,

I am trying to implement some common services for DataGrid control by
implementing IExtendee and providing users with some properties they can
set. I need to process some code in the DataGrid's Form Load event. So, I
wrote

If (Not (me.DesignMode)) Then
AddHandler DataGrid.FindForm().Load, AddressOf LoadHandler
End If

This is generating an exception at run time. I am not able to hook to the
Load event.

Any ideas or suggestions Please? I am trying to create something like a
Pluggin for all DataGrid controls in our project. Is there an easier way to
do this? I know I could have inherited the DataGrid control and wrote code
there, but didn't want to do sos This sounded more fun.

Thanks

Raju...
Nov 21 '05 #1
2 1621
"Raju Joseph" <vz******@msn.com> schrieb:
If (Not (me.DesignMode)) Then
AddHandler DataGrid.FindForm().Load, AddressOf LoadHandler
End If

This is generating an exception at run time. I am not able to hook to the
Load event.


What type of exception?

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>
Nov 21 '05 #2
Sorry, I should have been more specific.

First my form does not even show up within the MDI form after executing the
line

If (Not (me.DesignMode)) Then
AddHandler DataGrid.FindForm().Load, AddressOf LoadHandler
End If

The form cannot be seen.

The exception happend when I close the MDI Form complaining about the
following code written in the Dispose method of my component.

If (Not (me.DesignMode)) Then
RemoveHandler DataGrid.FindForm().Load, AddressOf LoadHandler
End If

Hope this gives some insight. I am still trying to find out why this is
happening.

Thanks
"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message
news:OZ**************@TK2MSFTNGP14.phx.gbl...
"Raju Joseph" <vz******@msn.com> schrieb:
If (Not (me.DesignMode)) Then
AddHandler DataGrid.FindForm().Load, AddressOf LoadHandler
End If

This is generating an exception at run time. I am not able to hook to the Load event.


What type of exception?

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

Nov 21 '05 #3

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

Similar topics

8
2489
by: SunshineGirl | last post by:
I'm trying to trigger an app with the following code from a message queue. It works with only the message box voilą! enabled. But it causes the exception below when it is triggered with the rest of...
0
445
by: Scott | last post by:
I am trying to use the AddHandler method inside a DataList_ItemDataBound control. Here is the function Private Sub DataList1_ItemDataBound(ByVal sender As Object, ByVal e As...
1
2220
by: Luis Esteban Valencia Muńoz | last post by:
Have a dropdownlist created in my LoadMain() which is called from the Page_load: ************************PAGE LOAD********************8Private Sub Page_Load(ByVal sender As System.Object, ByVal e...
2
2757
by: Just Me | last post by:
When a document is to be printed I call a method that contains an AddHandler statement. I just realized that if a second copy is to be printed the method is called and the AddHandler is executed...
6
9139
by: Carlo3030 | last post by:
Been reading Dino Esposito's Article "A DetailsView Control for ASP.NET 1.x" found in the msdn Library. His example was created using VB.NET. I am trying to convert the example (DetailsView...
2
2462
by: google | last post by:
I statically link the Synopsys Milkyway C-API library ("MDA") into my C++ application. When my C++ application throws an exception, it seg faults instead. The details of my environment are:...
3
3205
by: doubts | last post by:
Hi all, I am trying to convert my bulk of code from VC++ 6.0 to VC++.Net. when using std::string type variable, the application causes exception at one instance and does not cause an exception at...
7
15659
by: illegal.prime | last post by:
Hi all, I've got a client/server application and just wanted to ensure that this is expected behavior. I recently set the following configuration in Visual Studio: Debug->Exceptions->Break Into...
5
2194
by: Slim | last post by:
i have a simple page, with one button button1. when click it creates a new button button 2 and adds a event handler to it. but when button 2 is clicked nothing happens, why? Partial Class...
0
7166
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
1
7106
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...
0
7534
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
5094
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...
0
4749
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...
0
3236
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3226
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
805
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
459
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.