Re: Strange behaviour of Str$



Ah, sorry, I didn't read your original post fully. I tried this and can
reproduce it here under W2k (in the IDE) using VB6 SP5. Looks like a
synchronisation problem to me. I noticed that the first time you change the
regional settings, it takes an inordinate length of time for the operation
to complete, unless you start it immediately after running your form. If you
can change the settings quickly enough after starting the form then it traps
as you said. If you wait too long then the operation takes ages to complete,
and I cannot reproduce it until the form is re-started again.from the
beginning.

Tony Proctor

"John Carlyle-Clarke" <john.cc@xxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:Xns96B77DC378964johncceuroplacercouk@xxxxxxxxxxxxxxx
> "John Carlyle-Clarke" <john.cc@xxxxxxxxxxxxxxxxxxxxxxx> wrote in
> news:Xns96B76676367CCjohncceuroplacercouk@xxxxxxxxxxxx:
>
> > My application was running on an XP SP2 machine, with the regional
> > settings set to give a "." as the decimal separator.
> >
> > I went into the control panel, and changed the settings to a ","
> > decimal separator, while the app was running.
> >
> > At that point, I got an error which looks like it was caused by
> > Str$ returning a number like 2.94 as "2,94". This code runs on a
> > regular timer, and the error only occured once. It also doesn't
> > occur if you switch regions with the app shut down.
> >
>
>
> You can reproduce this. Create a blank form with a button and drop
> this code on.
>
> Private Sub cmdGo_Click()
> Dim i As Long
> Dim output As String
>
> cmdGo.Enabled = False
>
> For i = 1 To &HFFFFFF
>
> output = Str$(1.234)
> If InStr(1, output, ",") <> 0 Then
> Call MsgBox("Got " & output & " !!")
> Exit Sub
> End If
> Next
>
> cmdGo.Enabled = True
>
> End Sub
>
>
> Start the app and hit the button and try switching between e.g.
> English(United Kingdom) and German(Germany).
>
> It doesn't happen everytime, but you should be able to make the
> message box show.. I can.


.


Loading