473,385 Members | 1,869 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,385 software developers and data experts.

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
"TextChangedEvent" 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 TextChangedEvent(ByVal obj As Object, ByVal ea As
EventArgs)

Protected Sub txt1Changed(ByVal obj As Object, ByVal ea As
EventArgs) Handles txt1.TextChanged
RaiseEvent TextChangedEvent(obj, ea)
End Sub

Protected Sub txt2Changed(ByVal obj As Object, ByVal ea As
EventArgs) Handles txt2.TextChanged
RaiseEvent TextChangedEvent(obj, ea)
End Sub

Protected Sub txt3Changed(ByVal obj As Object, ByVal ea As
EventArgs) Handles txt3.TextChanged
RaiseEvent TextChangedEvent(obj, ea)
End Sub

Protected Sub txt4Changed(ByVal obj As Object, ByVal ea As
EventArgs) Handles txt4.TextChanged
RaiseEvent TextChangedEvent(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 927

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

Similar topics

7
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....
14
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
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...
15
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...
1
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
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.