Click here to Skip to main content
15,881,248 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

I would like to design one xml text editor which is based on normal text-box which implements all XML characteristics.
1. Can any one give me the idea how i could process the each and every character entered by the user(normally we can call the TextBox1_TextChanged event after fully entered the text in text-box but i need to call this event each and every character entry)?
I am good in C#, so that i have decided to transform the control to coding page because i already did one editor using console application which read the input character from the user and change the text color.
2. I might be wrong to approach this problem like this way so, give your suggestions, valuable reference links and ideas to accomplish this editor.

Thanks in Advance

Regards,
--SJ
Posted
Updated 14-Apr-13 21:57pm
v2
Comments
BillWoodruff 17-Apr-13 2:59am    
Please add some more specifics about exactly what functionality your XML editor will provide

For example: how "smart" does your XML editor need to be: are you going to keep track of nesting levels, and monitor every character: so that if a user enters an extra close-angle-bracket that would render the XML invalid: are you going to catch that right away ... or are you going to scan the text contents for proper nesting closures only when the user triggers it, or the file is saved ?

This CodeProject article shows a complete XML editor (with color syntax highlighting); you can probably get some ideas from it: http://www.codeproject.com/Articles/70461/XML-Editor-Control
codeninja-C# 17-Apr-13 3:49am    
Hi BillWoodruff, I would like to design XML editor (same as Visual Studio 2008, while creating new XML file that window contain all the properties of XML) in asp.net web page. I also updated my question in
http://www.codeproject.com/Questions/578304/XMLplustextplusEditorplus-plusTextplusBox
--SJ

1 solution

For your 1st statement use KeyPress event, it will be triggered everytime you hit a key.


C#
private void textBox1_KeyPress(object sender, KeyPressEventArgs e)
        {
            if(char.IsDigit(e.KeyChar))
            {
                MessageBox.Show("is digit");
            }
        }
 
Share this answer
 
Comments
codeninja-C# 17-Apr-13 3:52am    
Hi, in text box i don't find "KeyPress" event. how could i achieve it?
--SJ
Thomas Barbare 17-Apr-13 4:46am    
Oh sorry, it's an ASP application... I thought it was windows form.
Do you really wants to do a postback everytime user type ? I think it will cost too much especially if a lot of user are typing at the same time. But if you want to do that consider using Javascript to call the postback with his keypress event.
Hope that help you
codeninja-C# 17-Apr-13 8:04am    
Hi Thomas, Thanks. you can find my full requirement from following URL
http://www.codeproject.com/Questions/578304/XMLplustextplusEditorplus-plusTextplusBox

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900