Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Containg Types Or Base Types

Reply
Thread Tools

Containg Types Or Base Types

 
 
rn5a@rediffmail.com
Guest
Posts: n/a
 
      11-22-2006
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?

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
reading file containg passwords John Perl Misc 5 11-15-2010 02:12 PM
How to join folders containg pictures taken with two different cameras arouth@radiology.umsmed.edu Digital Photography 11 07-25-2005 06:30 PM
Problems opening a file containg , or (swedish characters) Henke ASP .Net 5 10-19-2004 02:46 PM
Find target and open containg folder options fail to work Black Baptist Computer Support 0 07-18-2004 01:29 AM
Virtual function 'BasicMidReader::~BasicMidReader()' conflicts with base class 'base 'TMemoryStream' tomek C++ 2 12-01-2003 06:31 AM



Advertisments