tags:

views:

24

answers:

1

I want to convert text which user is copying from my textbox.

For example:

text of myTextBox is "12,34"

and I want to give user:

myTextBox.Text.Replace(",",".") <. "12.34"

Then he could paste this text anywhere in this format (for example in webbrowser).

Anyone know simple way to do this ?

Thank you

+3  A: 

Are you working on windows based application if yes than you can make use of ClipBoard class

            string strData=default(string);

             object obj = Clipboard.GetData(DataFormats.Text);

            if (obj == null)
            {

                return;
            }
            else
                 strData = obj.ToString();

           strData = strData.Replace(",",".") 


           Clipboard.SetData("Text", strData);

Now when user paste somewhere , it will use formatted text.

saurabh