I am taking the reading of a scaner in a textbox but I need to make a function that only allows the scans that start with "3S", otherwise it tells me error.
I use this method which I only declare within the event TextChanged
of textbox1 in this case.
string a and string b are this case " 3S " and " 3s ", with which I determine that with they should start the text.
Take the reading but I'm removing the " 3S ", I need all the reading.
private void opcion1(TextBox txt)
{
string s = txt.Text;
string a = Properties.Settings.Default.op11;
string b = Properties.Settings.Default.op12;
if(s != "")
{
if(s.Length >= 2)
{
if (s.startswith(a) || s.startswith(b))
{
if (s.Length > 2)
{
}
else
{
s = "";
}
txt.Text = s;
}
}
}