Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CSHARP

C# convert random numbers in textBox to currency

public void textchange(object sender, EventArgs e)
{
   if(textbox1.Text.Contains("$"))
   {
     string valueToConvert = textbox1.Text.replace("$","");
     double newVal = Convert.ToDouble(valueToConvert);

     //Assign the new value with $ to textbox1
     textbox1.Text = "$"+Convert.ToString(newVal);
   }
}
Source by www.codeproject.com #
 
PREVIOUS NEXT
Tagged: #convert #random #numbers #textBox #currency
ADD COMMENT
Topic
Name
6+1 =