Solved

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

Posted on 2004-09-30
3
3,642 Views
Last Modified: 2008-08-02
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
Comment
Question by:MimerQ
3 Comments
 
LVL 7

Expert Comment

by:dttri
ID: 12197219
 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
 
LVL 6

Accepted Solution

by:
viola123 earned 50 total points
ID: 12197314
private void getValue()
{
     double aa;
     aa = double.parse(this.textBox.text) * 1.25;
     this.textBox.text = aa.ToString();
     
}
0
 

Expert Comment

by:looknow12
ID: 22143946
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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article describes a simple method to resize a control at runtime.  It includes ready-to-use source code and a complete sample demonstration application.  We'll also talk about C# Extension Methods. Introduction In one of my applicationsā€¦
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a feā€¦

828 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question