📜  C# 将文本框中的随机数转换为货币 - C# 代码示例

📅  最后修改于: 2022-03-11 14:48:46.904000             🧑  作者: Mango

代码示例2
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);
   }
}