I’d like a textbox that allows for certain text within to be ‘constant’ and uneditable while the rest of the text is editable. For instance, I’d like to define a template like this:
<Name:>[] <Address:>[] <City>:[]
So that the user could later enter:
<Name:>[Stefan] <Address:>[Nowhere] <City>:[Alaska]
But not:
<I'm typing here lol:>[Stefan] <Address:>[Nowhere] <State>:[Alaska]
Ideally, they wouldn’t even be able to put their cursor in between the <>, similar to Microsoft Word templates.
Any ideas? The masked textbox control seems to be along the right path, but isn’t multiline and doesn’t allow you to enter a variable number of characters in between the braces, for instance.
Thanks in advance.
I don’t know of any ready-made components. But you could try this simple method.
(.*)or([a-z]*)or whatever wherever you want the user to add text.You can then use the same regex to extract your data from the text box.
You could even use a RichTextBox and use the regex to perform formatting.
Update Here’s what I wrote. It seems to work: