Click here to Skip to main content
15,885,244 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
'm a newbie in C#. 'm having problems clearing textboxes on my form1 by clicking a
button on my "custom messagebox" i.e form 2. Any suggestions,codes,etc.
Posted
Comments
[no name] 8-Jun-15 7:04am    
And the "problem" that you have is..... what?
Naveen Kumar Tiwari 8-Jun-15 7:06am    
what do you want to do so? can you provide bit more information?
Francis Donald Dowuona 8-Jun-15 7:14am    
i have a reset item in my menu_strip. when a user clicks on the reset button it loads form2 ,which acts as a message box by asking " Are you sure you want to clear content?". if the user clicks the "yes" button on this form(message box), the content of textboxes on form1 should be cleared.

1 solution

Assuming Form1 creates and displays the instance of Form2:
C#
Form2 f2 = new Form2();
f2.Show();
Or
C#
Form2 f2 = new Form2();
f2.ShowDialog();

Then the best way is to create an event in Form2 (the "Child") which is handled in Form1 (the "Parent"): Transferring information between two forms, Part 2: Child to Parent[^] shows you how.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900