Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9029947
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T07:22:12+00:00 2026-06-16T07:22:12+00:00

Soon I asked for help to read properties of textbox which is inside usercontrol.

  • 0

Soon I asked for help to read properties of textbox which is inside usercontrol.
Accessing to control inside of usercontrol
As I have been suggested I make one very simple public class with name xTextBox and use it as textbox in my usercontrol. That work fine.

Public Class xTextBox
    Inherits TextBox
End Class

Now I can simply read a property on that xTextbox from main program which contain that usercontrol:

Dim s As Integer = myUserControl.xTextBox1.SelectionStart

But now is a problem that I can’t get events of that Textbox in main program.
Maybe I can declare ‘Shadows Event TextChanged…’ etc, but I will need more events in different situations where usercontrol would be, and intentionally raising every of them don’t look elegant in mean of practical programming.

How to get events of those xTextbox to main program?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T07:22:13+00:00Added an answer on June 16, 2026 at 7:22 am

    If the your new UserControl has only one control and Inherits TextBox, then you can just attach the events like normal, either with the Property Editor, or Manually with AddHandler. If things are more complicated than that I would probably create a panel and put your new TextBox’s in it, then it will be a lot easier to access the events.

    Public Class myUserControl
        Inherits TextBox
    
    End Class
    
    
    Public Class Form1
    
        Public Sub New()
            InitializeComponent()
            AddHandler MyUserControl1.TextChanged, AddressOf MyUserControl_textChanged
        End Sub
    
        Private Sub MyUserControl_textChanged(sender As Object, e As EventArgs)
            Throw New NotImplementedException
        End Sub
    
    End Class
    

    Or if your UserControl has Multiple Custom TextBox’s in it, you can create a Custom Event and fire that in a common TextChanged Event on your UserControl and handle that in your Main Form.

    Public Class UserControl1
        Public Event TextChange(sender As Object, e As EventArgs)
    
        Private Sub MyUserControl_TextChanged(sender As System.Object, e As System.EventArgs) Handles MyUserControl1.TextChanged, MyUserControl2.TextChanged
            RaiseEvent TextChange(sender, e)
        End Sub
    End Class
    
    Public Class Form1
        Public Sub New()
            InitializeComponent()
    End Sub
        Private Sub UserControl11_TextChange(sender As System.Object, e As System.EventArgs) Handles UserControl11.TextChange
            MsgBox(CType(sender, TextBox).Name, MsgBoxStyle.Information)
        End Sub
    End Class
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have been asked to setup VisualSVN for Visual Studio 2008. Due to firewall
I realize this question has been asked many times and I am have looked
The questions regarding Bootstrapper & Chaining might have been asked before. I am trying
I've been asked to run a workshop and coding dojo soon for people to
I have been asked to develop a new, small, custom-specific CRM (Customer Relationship Manager)
This question has been asked more than once before, but I have not found
So, this question has been asked lots, and i have seen many different answers,
I've been asked to create a new control for a feature that we need,
We'll soon have some high school kids here in our company for some training
I'm very sure a variation of this has been asked before, and my asking

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.