Microsoft KB Archive/325330

= FIX: Numeric values do not parse correctly in Visual Basic .NET when you use Swedish language settings =

Article ID: 325330

Article Last Modified on 2/12/2007

-

APPLIES TO


 * Microsoft .NET Framework 1.0 Service Pack 1
 * Microsoft Visual Basic .NET 2002 Standard Edition

-



This article was previously published under Q325330



SYMPTOMS
Numeric values do not parse correctly in Visual Basic .NET (and in Visual C# .NET) when you use Swedish language settings.



RESOLUTION
A supported hotfix is now available from Microsoft, but it is only intended to correct the problem that is described in this article. Only apply it to systems that are experiencing this specific problem. This hotfix may receive additional testing. Therefore, if you are not severely affected by this problem, we recommend that you wait for the next .NET Framework service pack that contains this hotfix.

To resolve this problem immediately, contact Microsoft Product Support Services to obtain the hotfix. For a complete list of Microsoft Product Support Services telephone numbers and information about support costs, visit the following Microsoft Web site:

http://support.microsoft.com/contactus/?ws=support

Note In special cases, charges that are ordinarily incurred for support calls may be canceled if a Microsoft Support Professional determines that a specific update will resolve your problem. The usual support costs will apply to additional support questions and issues that do not qualify for the specific update in question.Important This fix requires .NET Framework SP1. This fix will not install on top of .NET Framework SP2

The English version of this fix has the file attributes (or later) that are listed in the following table. The dates and times for these files are listed in coordinated universal time (UTC). When you view the file information, it is converted to local time. To find the difference between UTC and local time, use the Time Zone tab in the Date and Time tool in Control Panel.

  Date         Time   Version       Size       File name --  02-Jul-2002  22:48  1.0.3705.293     65,536  Corperfmonext.dll 03-Jul-2002 13:24  1.0.3705.293  1,953,792  Mscorlib.dll 02-Jul-2002 22:47  1.0.3705.293  2,265,088  Mscorsvr.dll 02-Jul-2002 22:40                   10,256  Mscorlib.ldo 02-Jul-2002 22:47  1.0.3705.293  2,265,088  Mscorwks.dll



STATUS
Microsoft has confirmed that this is a problem in the Microsoft products that are listed in the &quot;Applies to&quot; section.



MORE INFORMATION
Some conversion functions in Visual Basic .NET (such as conversion from String to Double) do not work correctly when you use Swedish language settings. The same behavior occurs when you use NumberStyles.Any in Visual C# .NET.

The following code fails in Visual Basic .NET: d = CDbl(&quot;123 456&quot;) d = IsNumeric(&quot;123 456&quot;)

MySub(&quot;123 456&quot;)

Sub MySub(ByVal test As Double) .... End Sub System.Globalization.NumberStyles.Any fails in Visual C# .NET: d = Double.Parse(&quot;124 456&quot;,System.Globalization.NumberStyles.Any); The following code works correctly in Visual C# .NET: d = Double.Parse(&quot;124 456&quot;);

Steps to Reproduce the Behavior
  Create a simple Visual Basic .NET Windows Form, and then put the following sample code in the event procedure of two buttons: Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim d As Double Try d = CDbl(&quot;123 456&quot;) MsgBox(d) Catch Ex As Exception MsgBox(Ex.ToString) End Try End Sub

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click Dim d As Double Try d = IsNumeric(&quot;123 456&quot;) MsgBox(d) Catch Ex As Exception MsgBox(Ex.ToString) End Try End Sub  Change your language settings to Swedish, run the program, and then click the buttons.

Keywords: kbbug kbfix kbqfe kbnetframe100presp3fix kbvs2002sp1sweep kbhotfixserver KB325330

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.