By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
444,078 Members | 1,733 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 444,078 IT Pros & Developers. It's quick & easy.

Why is Format Slow the first time?

P: n/a
This code:
txRate.Text = Format(payRate, "C")

(payRate is already succesfully set to a value such as 15D)

takes about 3-4 seconds to run the first time, after that it's plenty fast.

What makes it slow on the first call?

Bob Graham

Nov 20 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
I've tried changing it to the more .net correct syntax:
txRate.Text = payRate .ToString("C")

But it still runs just as slow.

Funny thing is, I have identical code in another form that runs fast first
time, and that form was derived from this one.

Bob Graham

"Bob Graham" <rv*****@pacbell.net> wrote in message
news:a1******************@newssvr25.news.prodigy.c om...
This code:
txRate.Text = Format(payRate, "C")

(payRate is already succesfully set to a value such as 15D)

takes about 3-4 seconds to run the first time, after that it's plenty fast.
What makes it slow on the first call?

Bob Graham

Nov 20 '05 #2

P: n/a
Does it run slow when not attached to the debugger (Debug > Start Without
Debugging) or when compiled into release mode?

I have this problem with the first exception thrown in an application when
attached to the debugger - the first exception takes about 5-10 seconds or
so to be caught, but any exceptions thrown after that run ok. This still
happens even if the exception is raised and caught somewhere in the
framework. If an internal exception is being raised in the Format function,
this could be the cause. Goto the Debug > Exceptions window and set all
exceptions to be caught by the debugger and you'll see if an exception is
being raised.

Even if one is being raised, there isn't anything you can do about it. Rest
easy in the fact that it should run ok in Release mode ;)

HTH,

Trev.
"Bob Graham" <rv*****@pacbell.net> wrote in message
news:a1******************@newssvr25.news.prodigy.c om...
This code:
txRate.Text = Format(payRate, "C")

(payRate is already succesfully set to a value such as 15D)

takes about 3-4 seconds to run the first time, after that it's plenty fast.
What makes it slow on the first call?

Bob Graham

Nov 20 '05 #3

P: n/a
Trev,

Thanks for your reply, I never did find the reason for that problem; I
deleted the textbox and created another one with a different name, changed
the code refs and everything is fine. There were no errors being generated.
It seems like the control was 'poisoned' as it were, by some obscure setting
or the like. I should probably learn to read the .resx files or something.

Bob
"Trev Hunter" <hu*********@hotmail.com> wrote in message
news:eM**************@TK2MSFTNGP11.phx.gbl...
Does it run slow when not attached to the debugger (Debug > Start Without
Debugging) or when compiled into release mode?

I have this problem with the first exception thrown in an application when
attached to the debugger - the first exception takes about 5-10 seconds or
so to be caught, but any exceptions thrown after that run ok. This still
happens even if the exception is raised and caught somewhere in the
framework. If an internal exception is being raised in the Format function, this could be the cause. Goto the Debug > Exceptions window and set all
exceptions to be caught by the debugger and you'll see if an exception is
being raised.

Even if one is being raised, there isn't anything you can do about it. Rest easy in the fact that it should run ok in Release mode ;)

HTH,

Trev.
"Bob Graham" <rv*****@pacbell.net> wrote in message
news:a1******************@newssvr25.news.prodigy.c om...
This code:
txRate.Text = Format(payRate, "C")

(payRate is already succesfully set to a value such as 15D)

takes about 3-4 seconds to run the first time, after that it's plenty

fast.

What makes it slow on the first call?

Bob Graham


Nov 20 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.