CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 6 of 6
  1. #1
    Join Date
    Apr 2011
    Posts
    10

    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");

  2. #2
    Join Date
    Jul 2001
    Location
    Sunny South Africa
    Posts
    11,283

    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#

  3. #3
    Join Date
    Apr 2011
    Posts
    10

    Re: Inserting a € symbol into a textbox in windows from?.

    still not working..im getting:

    'Input string was not in a correct format.'

  4. #4
    Join Date
    Apr 2011
    Posts
    10

    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");

  5. #5
    Join Date
    Jul 2001
    Location
    Sunny South Africa
    Posts
    11,283

    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.

  6. #6
    Join Date
    Mar 2004
    Location
    Prague, Czech Republic, EU
    Posts
    1,701

    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
  •  





Click Here to Expand Forum to Full Width

Featured