I bumped into a problem, i hope someone can help me out :) i got a textbox, and i want to limit users so that it isn't allowed to have two \ after each other. i'm using it for folders. for example: C\temp\test\ now i want to make it not possible to type C\temp\test\\
i've tried searching some around for this problem but i couldn't find anyting like this. so i hope it's possible :)
heres a code of my textbox how it is now
private void textBox1_TextChanged(object sender, EventArgs e)
{
try
{
Regex regex = new Regex(@"[^C^D^A^E^H^S^T^]");
MatchCollection matches = regex.Matches(textBox1.Text);
if (matches.Count > 0)
{
MessageBox.Show("Character niet toegestaan!");
textBox1.Text = "";
}
clsOpslagMedium objOpslag; // definieert type object
objOpslag = new clsOpslagMedium(); // creert opject in memory
objOpslag.DriveLetterString = textBox1.Text;
}
catch (Exception variableEx1)
{
MessageBox.Show("Foutmelding: " + variableEx1.Message);
}
}
I hope someone can give some examples and that I provided enough information :)