Add control to form ,from UserControl
-
:rose: Hi. I have a User Control and i added it to my Tool Box.When you add this control to your form, user control shows a form with 1 button. I want to click the button and one Text Box be added on the Main Form(Form1). How can get the form in that time(from my User Control)?? This is Design time!! Thank you. :rose: CanI
-
:rose: Hi. I have a User Control and i added it to my Tool Box.When you add this control to your form, user control shows a form with 1 button. I want to click the button and one Text Box be added on the Main Form(Form1). How can get the form in that time(from my User Control)?? This is Design time!! Thank you. :rose: CanI
Repost! Don't post in more than one place - all you do is duplicate work and annoy people. Either post in the forums, or in Q&A. But not both.
Real men don't use instructions. They are only the manufacturers opinion on how to put the thing together.
-
Repost! Don't post in more than one place - all you do is duplicate work and annoy people. Either post in the forums, or in Q&A. But not both.
Real men don't use instructions. They are only the manufacturers opinion on how to put the thing together.
:rose: Sorry,My connection broke and i thought it wasn't saved. :rose: CanI
-
:rose: Sorry,My connection broke and i thought it wasn't saved. :rose: CanI
Fair enough - I've upvoted your question to counter the one vote. However, you can do away with the flowers in your question (if possible) though.
The funniest thing about this particular signature is that by the time you realise it doesn't say anything it's too late to stop reading it. My latest tip/trick Visit the Hindi forum here.
-
:rose: Hi. I have a User Control and i added it to my Tool Box.When you add this control to your form, user control shows a form with 1 button. I want to click the button and one Text Box be added on the Main Form(Form1). How can get the form in that time(from my User Control)?? This is Design time!! Thank you. :rose: CanI
i can not understand your question . plz provide more details
-
i can not understand your question . plz provide more details
:rose: Hi. Let me tell you again. I create a UserControl .OK!. In Load event i write this:
private void UserControl1\_Load(object sender, EventArgs e) { //Add Form1 to your UserControl with one Button on(button 1) it.Think we did design it. Form1 f1=new Form1(); f1.Show Dialog(); }
And now in that button(f1.button1) write this:
private void button1\_Click(object sender, EventArgs e) { TextBox textBox= new TextBox(); textBox.Text="Name"; //And now work start. //Now i want to get the Form that you add the **UserControl** on it,Got it??The Main Form that Contain the UserControl. //Form1 or any other name Form1 f1=new Form1(); f1.Controls.Add(textBox); // }
The question is How to get that form and throw(Add) the textBox on it!!We don't have it now!!??What a code should we write? I hope you understand what i am telling you. Thank you. :rose: CanI