Solved

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

Posted on 2004-09-30
3
3,660 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

In order to hide the "ugly" records selectors (triangles) in the rowheaders, here are some suggestions. Microsoft doesn't have a direct method/property to do it. You can only hide the rowheader column. First solution, the easy way The first sol…
This article introduced a TextBox that supports transparent background.   Introduction TextBox is the most widely used control component in GUI design. Most GUI controls do not support transparent background and more or less do not have the…

738 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