1
I’m using Visual Studio to make an application using Windows Forms in C# and I need to get all the Maskedtextbox of the form, without masks.
I’m using the code below right now. The Maskedtexbox are obtained, but does not eliminate the masks to make the if. Does anyone have any suggestions?
foreach (Control c in ctrl.Controls)
{
//Analisa os Maskedtextbox
if (c is MaskedTextBox)
{
((MaskedTextBox)c).Text.Replace("/", "").Replace(",", "").Replace("-", "");
if ((((MaskedTextBox)c).Tag == "*") && (((MaskedTextBox)c).Text.Length<=4))
{
retorno = true;
((MaskedTextBox)c).BackColor = System.Drawing.Color.FromArgb(255, 192, 192);
MessageBox.Show(c.Text);
}
else
((MaskedTextBox)c).BackColor = System.Drawing.Color.FromArgb(255, 255, 192);
}
}
from an example please that your code did not work.....
– Fabrício Mendes