Decimal separator

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • T.K Kullervo

    Decimal separator

    Hi, is there someway to change the regional settings--> numbers--> decimal
    separator for the the program im creating. I dont want to change it
    permanently but my program doesnt work if the separator is a comma.


  • Mattias Sjögren

    #2
    Re: Decimal separator

    [color=blue]
    >but my program doesnt work if the separator is a comma.[/color]

    Then why don't you fix your program instead of messing with the user's
    settings?



    Mattias

    --
    Mattias Sjögren [MVP] mattias @ mvps.org

    Please reply only to the newsgroup.

    Comment

    • T.K Kullervo

      #3
      Re: Decimal separator

      Thats what i meant, how can i change the program to use dots as decimal
      separators instead of commas if the regional settings decimal separator is
      selected as a comma.

      "Mattias Sjögren" <mattias.dont.w ant.spam@mvps.o rg> wrote in message
      news:OaNCRbGbDH A.2548@TK2MSFTN GP09.phx.gbl...[color=blue]
      >[color=green]
      > >but my program doesnt work if the separator is a comma.[/color]
      >
      > Then why don't you fix your program instead of messing with the user's
      > settings?
      >
      >
      >
      > Mattias
      >
      > --
      > Mattias Sjögren [MVP] mattias @ mvps.org
      > http://www.msjogren.net/dotnet/
      > Please reply only to the newsgroup.[/color]


      Comment

      • Malleier Alfred

        #4
        Re: Decimal separator

        you need to study then System.Globaliz ation - namespace. In Msdn you will
        find the possibility to set your prefered Culture.
        To get the current separator:

        Dim DecimalSeparato r As Char =
        System.Globaliz ation.CultureIn fo.CurrentCultu re.NumberFormat .NumberDecimalS e
        parator

        Alfred M.

        "T.K Kullervo" <taisto69@hotma il.com> schrieb im Newsbeitrag
        news:%23as6B7Gb DHA.2032@TK2MSF TNGP10.phx.gbl. ..[color=blue]
        > Thats what i meant, how can i change the program to use dots as decimal
        > separators instead of commas if the regional settings decimal separator is
        > selected as a comma.
        >
        > "Mattias Sjögren" <mattias.dont.w ant.spam@mvps.o rg> wrote in message
        > news:OaNCRbGbDH A.2548@TK2MSFTN GP09.phx.gbl...[color=green]
        > >[color=darkred]
        > > >but my program doesnt work if the separator is a comma.[/color]
        > >
        > > Then why don't you fix your program instead of messing with the user's
        > > settings?
        > >
        > >
        > >
        > > Mattias
        > >
        > > --
        > > Mattias Sjögren [MVP] mattias @ mvps.org
        > > http://www.msjogren.net/dotnet/
        > > Please reply only to the newsgroup.[/color]
        >
        >[/color]


        Comment

        • Cor

          #5
          Re: Decimal separator

          Can you describe that better, what does not work, normaly it has to do
          everything automatic
          (The only strange thing I know now is that the culture settings in Net 1.1
          on W'98/Me stystems not are set by culture but by keyboard settings)


          Comment

          • T.K Kullervo

            #6
            Re: Decimal separator

            The program is used to send values to another program, which runs on the
            command prompt. The sent values are either selected by the user from
            numericupdowns or straight from an excel sheet. Then the cmd-program makes
            calculations based on the values sent to it.

            Private Sub StreamInput(ByV al strText As String)
            m_Process.Stand ardInput.WriteL ine(strText)

            m_Process.Stand ardInput.Flush( )

            End Sub

            This is the code used to send the values to the console program. Ive tried
            strText.replace (",","."). The Program works fine when the
            regional-options-->decimal symbol is set to ".",but when it is "," it doesnt
            work


            "Cor" <non@non.com> wrote in message
            news:3f4c760a$0 $29307$48b97d01 @reader21.wxs.n l...[color=blue]
            > Can you describe that better, what does not work, normaly it has to do
            > everything automatic
            > (The only strange thing I know now is that the culture settings in Net 1.1
            > on W'98/Me stystems not are set by culture but by keyboard settings)
            >
            >[/color]


            Comment

            • Mattias Sjögren

              #7
              Re: Decimal separator

              >Thats what i meant, how can i change the program to use dots as decimal[color=blue]
              >separators instead of commas if the regional settings decimal separator is
              >selected as a comma.[/color]

              Why don't you design your app to work correctly regardless of the
              decimal separator selected instead? Ignoring the user's settings tends
              to just cause confusion.



              Mattias

              --
              Mattias Sjögren [MVP] mattias @ mvps.org

              Please reply only to the newsgroup.

              Comment

              • Cor

                #8
                Re: Decimal separator

                TK
                Don't see the culture elements a string is just a string
                Did you do
                strText.replace (",",".") ' does nothing
                or
                strText = strText.replace (",",".")
                Cor



                Comment

                • T.K Kullervo

                  #9
                  Re: Decimal separator

                  strText = strText.replace (",","."). I dont know what the problem is, maeby
                  its with the other program. All i know is that the whole system works when
                  the decimal symbol is set to dot and it doesnt work when its set comma. I
                  put a textbox on the form and checked out the values sent. The values sent
                  from my program are like 3.45 not 3,45.


                  "Cor" <non@non.com> wrote in message
                  news:3f4c9206$0 $29344$48b97d01 @reader21.wxs.n l...[color=blue]
                  > TK
                  > Don't see the culture elements a string is just a string
                  > Did you do
                  > strText.replace (",",".") ' does nothing
                  > or
                  > strText = strText.replace (",",".")
                  > Cor
                  >
                  >
                  >[/color]


                  Comment

                  • Cor

                    #10
                    Re: Decimal separator

                    And that comes direct from the textbox without any cast?


                    Comment

                    • T.K Kullervo

                      #11
                      Re: Decimal separator

                      There are a number of numericupdowns which values are set to
                      InputStrings(12 ) and they are run from a loop to the StreamInput. Thank you
                      for your interest and help but im afraid i have to bypass this problem for
                      now, because i have more urgent things to solve. I know it would probably
                      help if i put more of the code for you to read, but im afraid thats not
                      possible. Thanks again

                      "Cor" <non@non.com> wrote in message
                      news:3f4caa4c$0 $29321$48b97d01 @reader21.wxs.n l...[color=blue]
                      > And that comes direct from the textbox without any cast?
                      >
                      >[/color]


                      Comment

                      Working...