none
Stream Builder

    Question

  • Dear Friends

    In my windows application i am trying to display the euro sign.

    it displays the sign but with extra character Â.

    can anyone help me how do i solve it?

    thanks.

    shweta

    Friday, December 04, 2009 10:39 AM

Answers

  • What type of Encoding are you using for your stream? € will not work with default encoding. You will also have to set encoding parameter.


    Gaurav Khanna
    Saturday, December 05, 2009 1:41 PM
  • Gaurav

    When i write your code i got the following output

    €5000 

    i am using stream writeralso in that.

    any idea?

    thanks.

    Shweta.



    try this it worked with me

            Using writer As StreamWriter = New StreamWriter("C:\Temp\NewTextFile.txt", True, Encoding.Default)
                writer.WriteLine("First Line of string here €5000")
                For i As Integer = 1 To 5000
                    writer.WriteLine(String.Format("{0}{1}", "€", FormatNumber(i, 2)))
                Next
            End Using









    John
    • Edited by Codernater Saturday, December 05, 2009 2:54 PM New Code
    • Marked as answer by Aland LiModerator Wednesday, December 09, 2009 8:40 AM
    Saturday, December 05, 2009 2:54 PM

All replies

  • Dear Friends

    In my windows application i am trying to display the euro sign.

    it displays the sign but with extra character Â.

    can anyone help me how do i solve it?

    thanks.

    shweta


    "Display the euro sign" can you please tell us where? is it a textbox, label, datagridview etc...

    Have you looked at the control properties under Design Category Change the language?

    you can also use something like this

    Me.Label_EuroCurrency.Text = String.Format("{0}{1}", "€", FormatNumber(myCurrency, 2))





    John
    Friday, December 04, 2009 11:18 AM
  • Johm thanks for the reply

    but what is formatnumber and mycurrency?

    cant u send me the complete code?

    thanks in advance.

    Shweta
    Friday, December 04, 2009 11:37 AM
  • FormatNumber is a a function in vb.net. Mycurrency is just a variable which you will need to replace with your currency value.

    So value of 5000 will be displayed as €5000 using below code

    Me.Label_EuroCurrency.Text = String.Format("{0}{1}", "€", FormatNumber(5000, 2))

     




    Gaurav Khanna
    Friday, December 04, 2009 2:00 PM
  • but what is formatnumber and mycurrency?


    myCurrency is a Decimal Variable

            Dim myCurrency As Decimal = 5000
            Me.Label_EuroCurrency.Text = String.Format("{0}{1}", "€", FormatNumber(myCurrency, 2))

    John
    Friday, December 04, 2009 2:51 PM
  • John

    Thanks for the reply.

    But what if i dont want to use FormatNumber nd mycurrency?

    Thanks.

    Shweta
    Saturday, December 05, 2009 4:44 AM
  • FormatNumber is just to format the value as a numeric. You can ignore it if you want. MyCurrency is a variable and you can have other variable if you want or write as below

    Me.Label_EuroCurrency.Text = String.Format("{0}{1}", "€", 5000)

    OR

    Me.Label_EuroCurrency.Text = "€5000"

    Gaurav Khanna
    Saturday, December 05, 2009 6:09 AM
  • Gaurav

    When i write your code i got the following output

    €5000 

    i am using stream writeralso in that.

    any idea?

    thanks.

    Shweta.

    Saturday, December 05, 2009 6:29 AM
  • What type of Encoding are you using for your stream? € will not work with default encoding. You will also have to set encoding parameter.


    Gaurav Khanna
    Saturday, December 05, 2009 1:41 PM
  • Gaurav

    When i write your code i got the following output

    €5000 

    i am using stream writeralso in that.

    any idea?

    thanks.

    Shweta.



    try this it worked with me

            Using writer As StreamWriter = New StreamWriter("C:\Temp\NewTextFile.txt", True, Encoding.Default)
                writer.WriteLine("First Line of string here €5000")
                For i As Integer = 1 To 5000
                    writer.WriteLine(String.Format("{0}{1}", "€", FormatNumber(i, 2)))
                Next
            End Using









    John
    • Edited by Codernater Saturday, December 05, 2009 2:54 PM New Code
    • Marked as answer by Aland LiModerator Wednesday, December 09, 2009 8:40 AM
    Saturday, December 05, 2009 2:54 PM