473,426 Members | 3,819 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,426 software developers and data experts.

Missing events in MyBase when using control inheritance

I have been programming in C# for the past few years and I'm now trying
to implement something in VB.NET (Framework 1.1) that I'm having a
problem with...

In C# I can create a new class and make it dervived from a Microsoft
Windows Forms control (e.g. TabControl), then in the constructor I can
add an event handler to the ControlAdded and ControlRemoved events like
so:

public Class1()
{
//
// TODO: Add constructor logic here
//

this.ControlAdded += new ControlEventHandler(Class1_ControlAdded);
this.ControlRemoved += new
ControlEventHandler(Class1_ControlRemoved);

}

The ControlAdded and ControlRemoved events are protected events of the
base class TabControl, when attempting this Using VB.NET it fails, for
example. This:
Private Sub TabControl1_ControlAdded(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles MyBase.ControlAdded

End Sub

Creates a compile time error and Visual Studio.NET intellisense does
not show ControlAdded and ControlRemoved events as being available
events off of MyBase.

I would like to know if anyone can recommend a work around to this. I
really need to handle these two events in my dervived control.

Thanks.

Nov 23 '05 #1
1 1598
<Je**********@gmail.com> schrieb:
Private Sub TabControl1_ControlAdded(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles MyBase.ControlAdded


'System.EventArgs' => 'ControlEventArgs'.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>
Nov 23 '05 #2

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

Similar topics

5
by: Dayne | last post by:
Can a Parent thread catch a event send by a child thread? Dayne
14
by: JPRoot | last post by:
Hi I use the following syntax to have events inherited from base to child classes which works nicely (virtual and override keyword on events). But I am wondering if it is a "supported" way of using...
8
by: JPRoot | last post by:
Hi M. Jeffrey Tan, Just hopping you didn't forget me? :) Thanks JPRoot ----- \"Jeffrey Tan\" wrote: -----
6
by: Mark | last post by:
I have been working for quite some time on this issue which in theory should be quite simple. The problem is that the Cancel and Save events are not fired when their respective buttons are...
3
by: Harry | last post by:
Dear all, It is found that when a webform control trigger an event, Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load End Sub This...
10
by: Chad Miller | last post by:
I currently have a base form that I inherit. The base for has a custom event. The event will not raise threw the inherited form. I was wondering if events work threw inheritance or should I use...
2
by: Carl Tribble | last post by:
Is there any way to reliably catch KeyUp events for Function keys in particular while inside a datagrid? I have a form with KeyPreview=True and I am using the Form.KeyUp event to handle several...
2
by: Dennis | last post by:
I have a control that inheirts from "Panel". I want to prevent the user from having access to the MoueUp event. I tried making a sub in my control that handles MyBase.MouseUp but still this event...
9
by: Nathan Sokalski | last post by:
I have a very simple UserControl which contains an Image and a Label, which I use to display an image with a caption. I am using this control inside a DataList, setting the two Public variables...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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,...
0
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...
0
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...
1
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
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...
0
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
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
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.