Jay Stewart

Jay Stewart

  • NA
  • 164
  • 1.6k

class/textbox/loop

May 22 2017 7:17 PM
I have a class with the follwing method in 
 
  1. public static void myMethod(Home_Form formObject)  
  2. {  
  3.     foreach (Control X in formObject.Controls)  
  4.     {  
  5.         var tb = X as TextBox;  
  6.         if (tb  !=null)  
  7.         if (tb.Text == @"53")  
  8.         {  
  9.               
  10.             tb.Text = @"Hammer";  
  11.         }  
  12.     }  
  13. }  
And in my Mainform
 
  1. private void bonus1TypeTextBox_TextChanged(object sender, EventArgs e)  
  2.        {  
  3.            Variables.myMethod(this);  
  4.        }  
Now I Know this is wrong, But if any text box on my Main Form contains 53 when being pulled from a dataset I need to changes its text to Hammer....
 
Can somebody please advice, hope I have made myself clear.
 
 
Jay  

Answers (4)