• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 3759
  • Last Modified:

Cannot implicitly convert type 'double' to 'string' (textbox.Text *= 1.25;)

In VB.NET you can write textBox.Text *= 1.25, but in C# I got this error:
Cannot implicitly convert type 'double' to 'string'

How do you multiply a textbox value with something?
0
MimerQ
Asked:
MimerQ
1 Solution
 
dttriCommented:
 Hello,
  To convert between for example string and double, you can use these member functions of Double class:

    public static double Parse(string)
    public override string ToString()

  Tri
0
 
viola123Commented:
private void getValue()
{
     double aa;
     aa = double.parse(this.textBox.text) * 1.25;
     this.textBox.text = aa.ToString();
     
}
0
 
looknow12Commented:
That one was silly, I fixed it with this.

eTotal.Text = Convert.ToString(Convert.ToDouble(Convert.ToDecimal(eKWUsage.ToString()) + Convert.ToDecimal(eRate.ToString())));

Open in new window

0

Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now