473,804 Members | 2,136 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Containg Types Or Base Types

A user control file named Address.ascx has 4 TextBoxes. The logic of
this user control is encapsulated in a code-behind file named
Address.ascx.vb . The code-behind also defines an Event named
"TextChangedEve nt" which handles the TextChanged event of the 4
TextBoxes.

Namespace Address
Public Class AddressCB : Inherits UserControl
Public txt1 As TextBox
Public txt2 As TextBox
Public txt3 As TextBox
Public txt4 As TextBox

..........
..........

Public Event TextChangedEven t(ByVal obj As Object, ByVal ea As
EventArgs)

Protected Sub txt1Changed(ByV al obj As Object, ByVal ea As
EventArgs) Handles txt1.TextChange d
RaiseEvent TextChangedEven t(obj, ea)
End Sub

Protected Sub txt2Changed(ByV al obj As Object, ByVal ea As
EventArgs) Handles txt2.TextChange d
RaiseEvent TextChangedEven t(obj, ea)
End Sub

Protected Sub txt3Changed(ByV al obj As Object, ByVal ea As
EventArgs) Handles txt3.TextChange d
RaiseEvent TextChangedEven t(obj, ea)
End Sub

Protected Sub txt4Changed(ByV al obj As Object, ByVal ea As
EventArgs) Handles txt4.TextChange d
RaiseEvent TextChangedEven t(obj, ea)
End Sub
End Class
End Namespace

When the user control is executed, ASP.NET generates the following
error:

Handles clause requires a WithEvents variable defined in the containing
type or one of its base types.

pointing to the

Protected Sub txt1Changed(... .....)

line. I resolved the problem by declaring the 4 TextBoxes shown above
using WithEvents

Public WithEvents txt1 As TextBox
Public WithEvents txt2 As TextBox
Public WithEvents txt3 As TextBox
Public WithEvents txt4 As TextBox

Though my problem has been resolved, I couldn't exactly understand what
the error message means especially the part "defined in the containing
type or one of its base types". Can someone please explain me what does
"defined in the containing type or one of its base types" mean? Which
is the "containing type" here? Also does "base types" refer to the user
control?

Nov 22 '06 #1
0 954

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

Similar topics

7
3673
by: svilen | last post by:
hello again. i'm now into using python instead of another language(s) for describing structures of data, including names, structure, type-checks, conversions, value-validations, metadata etc. And i have things to offer, and to request. And a lot of ideas, but who needs them.... here's an example (from type_struct.py):
14
2015
by: Stefan Slapeta | last post by:
Hi, this code does not compile in C#: class base_class {} class derived_class : base_class {} class A { public virtual base_class f()
6
2557
by: miked | last post by:
Why are there still no covariant return types? All searches reveal no workarounds accept for using an interface which is a real pain. I wind up missing this capability almost every time I inherit a class. The best workaround and one that I use is the new keyword and cast the base class reference, but in my opinion this is a bad practice leading to error prone code. Can someone from MS chime in on this and provide some feedback?
15
3540
by: Juha Nieminen | last post by:
I'm sure this is not a new idea, but I have never heard about it before. I'm wondering if this could work: Assume that you have a common base class and a bunch of classes derived from it, and you want to make a deque which can contain any objects of any of those types. Normally what you would have to do is to make a deque or vector of pointers of the base class type and then allocate each object dynamically with 'new' and store the...
0
9711
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
10595
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...
1
10335
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,...
0
9169
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5529
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5668
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4306
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
2
3831
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3001
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.