Help with a C# question?

I dont like waiting on StackOverflow to answer, so I thought I'd ask in more than one place…

Ok, so I am new to custom controls, and need be able to get the contents of a text box that is part of a custom user control.

Here is an image of the control its self:

Say I want to access the text that the user has entered in the Name Textbox, how would I do this? What would I have to add to the code for the control? Or is there a way to just reference it from the form that the control is on?

Here is the code for the control:

public partial class CharacterControl : UserControl { public CharacterControl() { InitializeComponent(); } private void get_start_Click(object sender, EventArgs e) { starttime.Text = DateTime.Now.ToString("HH:mm"); } private void get_end_Click(object sender, EventArgs e) { endtime.Text = DateTime.Now.ToString("HH:mm"); } } 

Thanks in advance for the help, and here is a link to the question should you want to answer over there:

by Col_Crunch via /r/csharp

Leave a Reply