Home  |  Index  |  Dotnet4all Snippets  |  Submit resources
About  |  Mail us  
Dotnet4all Logo

  User Control Events and .NET (Saturday, September 04, 2004)




Found the following interesting discussion in the Newsgroups:

User Control Events
by:Anonymous

I have a user control and it has a textbox. I added it to form. But i can't use the textbox's events on form. How can i do it? Pls help me.


 Reply:
by:Ken Tucker [MVP]

 Hi,

You will have to raise the events your self when the textchanges.
Here is a simple example.

Public Class UserControl1
Inherits System.Windows.Forms.UserControl
#Region " Windows Form Designer generated code "
Public Shadows Event TextChanged(ByVal sender As Object, ByVal e As
EventArgs)
Public Shadows Property Text() As String
Get
Return TextBox1.Text
End Get
Set(ByVal Value As String)
TextBox1.Text = Value
End Set
End Property

Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles TextBox1.TextChanged
RaiseEvent TextChanged(Me, e)
End Sub
End Class

Ken


 Reply:
by:WStoreyII

 what does the shadow Term do ken?

WSToreyII


 Reply:
by:Ken Tucker [MVP]

 Hi,

It allows you to overload something that is not set up to be overloaded. See the article below for a good explaination.

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnadvnet/html/vbnet12252001.asp
Ken








 
Previous Posts
    - Direct sound and .NET
    - Application Development Using C# and .NET
    - Introduction to C# Using .NET
    - Essential .NET, Volume I: The Common Language Runt...
    - Programming with Managed Extensions for Microsoft ...
    - Application Development Using C# and .NET
    - Visual C++.NET: How to Program
    - Beginning Visual C# (Programmer to Programmer)
    - Visual C++.NET: How to Program
    - .NET Compact Framework Programming with C# (Micros...

Archives
    - 08/01/2004 - 08/08/2004
    - 08/08/2004 - 08/15/2004
    - 08/15/2004 - 08/22/2004
    - 08/22/2004 - 08/29/2004
    - 08/29/2004 - 09/05/2004
    - 09/05/2004 - 09/12/2004
    - 09/12/2004 - 09/19/2004
    - 09/19/2004 - 09/26/2004
    - 09/26/2004 - 10/03/2004
    - 10/03/2004 - 10/10/2004
    - 01/02/2005 - 01/09/2005
    - 01/09/2005 - 01/16/2005
    - 01/30/2005 - 02/06/2005
    - 01/01/2006 - 01/08/2006


Disclaimer & Terms of Use  | DotNet4All.Com concept & © 2004 - 2007 by  Zelders²  - Holland