int _Medicianlimit = 3;
etMedicationName.TextChanged += (sender, args) =>
{
string _text = etMedicationName.Text; //Get Current Text
bool isDotValue = isDot(etMedicationName);
if (_text.Length == 2)
{
char[] chars = _text.ToCharArray();
if (chars[1]!='.')
{
_text = _text.Remove(_text.Length - 1);
etMedicationName.Text = _text;
}
}
else
{
if (_text.Length > _Medicianlimit) //If it is more than your character restriction
{
_text = _text.Remove(_text.Length - 1); // Remove Last character
etMedicationName.Text = _text; //Set the Old value
}
}
};
etMedicationName.TextChanged += (sender, args) =>
{
string _text = etMedicationName.Text; //Get Current Text
bool isDotValue = isDot(etMedicationName);
if (_text.Length == 2)
{
char[] chars = _text.ToCharArray();
if (chars[1]!='.')
{
_text = _text.Remove(_text.Length - 1);
etMedicationName.Text = _text;
}
}
else
{
if (_text.Length > _Medicianlimit) //If it is more than your character restriction
{
_text = _text.Remove(_text.Length - 1); // Remove Last character
etMedicationName.Text = _text; //Set the Old value
}
}
};
No comments:
Post a Comment