-
April 11th, 2011, 07:07 AM
#1
Inserting a € symbol into a textbox in windows from?.
Hiya folks i can put a £ symbol into the line but im not sure on the € sign?..can anyone help me please? I used "C" for sterling price but what do i use for the euro?
txtFinEuros.Text = (Convert.ToDecimal(txtBoxBrick.Text) * Convert.ToDecimal(textBoxLength.Text) * Convert.ToDecimal(txtEuros.Text)* Convert.ToDecimal(textBoxWidth.Text)).ToString("C");
-
April 11th, 2011, 08:01 AM
#2
Re: Inserting a € symbol into a textbox in windows from?.
Maybe a silly idea, but surely the easiest would be to insert € symbol in the Textbox during design time ( in its Text property press Alt + 0128 ) then do something like :
Code:
txtFinEuros.Text += (Convert.ToDecimal(txtBoxBrick.Text) * Convert.ToDecimal(textBoxLength.Text) * Convert.ToDecimal(txtEuros.Text)* Convert.ToDecimal(textBoxWidth.Text));
But it is strange though, if you have set up your PC's Regional settings properly to show Euros as a Currency symbol, this would not have been an issue, then you could have just done this :
Code:
txtFinEuros.Text = (Convert.ToDecimal(txtBoxBrick.Text) * Convert.ToDecimal(textBoxLength.Text) * Convert.ToDecimal(txtEuros.Text)* Convert.ToDecimal(textBoxWidth.Text)).ToString("C");
Do some research on Globalization in C#
-
April 11th, 2011, 11:15 AM
#3
Re: Inserting a € symbol into a textbox in windows from?.
still not working..im getting:
'Input string was not in a correct format.'
-
April 11th, 2011, 12:20 PM
#4
Re: Inserting a € symbol into a textbox in windows from?.
This is the code ive been working on..tried everything but to no use?..
//euros calculation
txtFinEuros.Text = "€";
txtFinEuros.Text = (Convert.ToDecimal(txtBoxBrick.Text) * Convert.ToDecimal(textBoxLength.Text) * Convert.ToDecimal(txtEuros.Text) * Convert.ToDecimal(textBoxWidth.Text)).ToString("F");
-
April 12th, 2011, 12:46 AM
#5
Re: Inserting a € symbol into a textbox in windows from?.
I thought you'd have figured out by now that because we are adding the € sign manually, it gest seen as a string, and therefore cannot be used in calculations. I'd suggest usinag a variable o store the calculation, then, add the € and the variable in the textbox.
-
April 12th, 2011, 06:48 AM
#6
Re: Inserting a € symbol into a textbox in windows from?.
You are replacint content of the txtFinEuros. Swap the steps and append:
Code:
txtFinEuros.Text = (Convert.ToDecimal(txtBoxBrick.Text) * Convert.ToDecimal(textBoxLength.Text) * Convert.ToDecimal(txtEuros.Text) * Convert.ToDecimal(textBoxWidth.Text)).ToString("F");
txtFinEuros.Text = txtFinEuros.Text + "€";
- Make it run.
- Make it right.
- Make it fast.
Don't hesitate to rate my post.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|