Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Type conversions
Message
From
14/06/2005 11:39:45
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
 
To
14/06/2005 09:45:26
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivia
General information
Forum:
ASP.NET
Category:
Coding, syntax and commands
Miscellaneous
Thread ID:
01023085
Message ID:
01023158
Views:
13
This message has been marked as a message which has helped to the initial question of the thread.
>Can the following be done without an intermediate variable?
>
>As one of the first sample application in class, we made a currency calculator. The command button was to take the numbers from two text boxes, multiply (or divide) them, and place the result into a third text box.
>
>The content of the first two textboxes, of course, had to be converted. IIRC, I did this with the method System.Double.Parse(). I assigned the multiplication to a variable, declared with:
>
>
>Double x;
>
>
>So, the calculation was something like:
>
>
>x = System.Double.Parse(TxtExchangeRate.Text) * System.Double.Parse(TxtAmount.Text)
>
>
>Then I saved x.ToString() to the result, something like this:
>
>
>txtResult.Text = x.ToString()
>
>
>However, we didn't manage to do the same without an intermediate variable. Is this possible?

Hi Hilmar,
Yes possible and at first it seems unbelieveable what you might do similarly:
txtResult.Text = 
 (Double.Parse(TxtExchangeRate.Text) * Double.Parse(TxtAmount.Text)).ToString();
You could also do this:

123.ToString();

:)

Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform