Help in Delimiter!
-
Hi, I actually facing problem in coding delimiter algorithm especially when user key in their entries in a rich textbox, the space that the user key in will be treated as delimiter (;).In other words, the space that user key-in after entering a word will be converted(interpreted) to ";" as delimiter symbol before user key in next word in the same line of text box as the second item. Please give me some guidance or any available reference/samples available algorithm on this in C# code.I need to clarify my doubts on this as soon as possible. Thanks..
-
Hi, I actually facing problem in coding delimiter algorithm especially when user key in their entries in a rich textbox, the space that the user key in will be treated as delimiter (;).In other words, the space that user key-in after entering a word will be converted(interpreted) to ";" as delimiter symbol before user key in next word in the same line of text box as the second item. Please give me some guidance or any available reference/samples available algorithm on this in C# code.I need to clarify my doubts on this as soon as possible. Thanks..
Maybe you mean something like this: string delimiter = ";"; textBox1.Text = textBox1.Text.Replace(" ", delimiter); :confused: ~Alexander Kent
-
Maybe you mean something like this: string delimiter = ";"; textBox1.Text = textBox1.Text.Replace(" ", delimiter); :confused: ~Alexander Kent
The above line provided does make sense..but how am i going to check if user key in space (" ") in the particular text box, the ";" will be replace onto it and the pointer for next word is after the symbol ";"? Thanks in advance, Lee
-
The above line provided does make sense..but how am i going to check if user key in space (" ") in the particular text box, the ";" will be replace onto it and the pointer for next word is after the symbol ";"? Thanks in advance, Lee
You can try and use the TextBox SelectionStart property – something like: In the KeyDown event if (e.KeyCode == Keys.Space) { // Cancel the event e.Handled = true; // Use your delimiter textBox1.Text += ";"; // Put the cursor after the newly appended text. textBox1.SelectionStart = textBox1.Text.Length; } ~Alexander Kent
-
You can try and use the TextBox SelectionStart property – something like: In the KeyDown event if (e.KeyCode == Keys.Space) { // Cancel the event e.Handled = true; // Use your delimiter textBox1.Text += ";"; // Put the cursor after the newly appended text. textBox1.SelectionStart = textBox1.Text.Length; } ~Alexander Kent
Yea..I have tried and it only works in C# form but what I face the problem of delimiter lies in Web Application Form in C# Project Folder..(fyi, I am trying to put my C# application into Web Based) I have tried to code the particular text box for the delimiter but it doesnt have SelectionStart function in Web Application.Thus, I used the previous code as below:- private void TextBox3_TextChanged(object sender, System.EventArgs e){ string delimiter =";"; if (TextBox3.Text.EndsWith(" ")) { TextBox3.Text += ";"; TextBox3.Text=TextBox3.Text.Repla ce(" ", delimiter); } } With this code, I face another problem which is when i enter the input then";" doesnt come up automatically..it only comes up occasionally especially after I let the Validation Error appear in other textbox. Please help me to clarify this doubt..I am stuck nowhere. Thanks, Lee