I followed discussion "access form control propertys via control name as string " but am getting NullReferenceException when trying to access any controls via their name using "this.Controls[CONTROL_NAME]".
private void mtbPh0_Leave(object sender, EventArgs e)
{
string callingControl = (sender as MaskedTextBox).Name;
this.Controls[callingControl].Visible=false;
I've manipulated callingControl to increment the last character, and I've tried just replacing the control name in the last line with a string (control name for a control that exists), but no matter what I do i get the NullReferenceException.
Is my syntax incorrect?