Guest User

Untitled

a guest
Mar 19th, 2018
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.82 KB | None | 0 0
  1. //this method in the userControl
  2. public void Clear()
  3. {
  4. //Clear your text box
  5. this.txtbox1.Text = string.Empty;
  6. //Do other clean-up things if you want
  7. }
  8.  
  9. private void button1_Click(object sender, EventArgs e)
  10. {
  11. //Call the Clear method from the UserControl
  12. yourUserControlName.Clear();
  13. }
  14.  
  15. private void button1_Click(object sender, EventArgs e)
  16. {
  17. YourForm();
  18. }
  19.  
  20. public partial class UserContoleName: UserControl{
  21. private static UserControleName _userControleName;
  22. public static UserControleName Instance{
  23. get{
  24. if(_userControleName == null){
  25. _userControleName = new UserControleName();
  26. }
  27. return _userControleName;
  28. }
  29. }
  30. public void Clear(){
  31. this.txtbox1.Text = string.Empty;
  32. }
  33.  
  34. private void Button_click(object sender,EventArgs e)
  35. {
  36. UserControleName.Instance.Clear();
  37. }
Add Comment
Please, Sign In to add comment