473,394 Members | 1,696 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Why is Format Slow the first time?

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
3 1255
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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Jeff L. | last post by:
Maybe I'm missing the obvious solution because I've been looking at this problem for so long, so I figured I'd throw it out and see if anyone can come up with some ideas. :) I'm writing a...
12
by: Neil | last post by:
I previously posted re. this, but thought I'd try again with a summary of facts. I have an Access 2000 MDB with a SQL Server 7 back end. There is a view that is linked to the database via ODBC...
8
by: Neil | last post by:
I have a very puzzling situation with a database. It's an Access 2000 mdb with a SQL 7 back end, with forms bound using ODBC linked tables. At our remote location (accessed via a T1 line) the time...
3
by: Jennyfer J Barco | last post by:
In my application I have a datagrid. The code calls a Stored procedure and brings like 200 records. I created a dataset and then a dataview to bind the results of the query to my grid using ...
6
by: B B | last post by:
Okay, here is what's happening: I have a reasonably fast laptop (1.4 GHz Mobile M, so comparable to 2.5GHz P4) doing .net development. Running Windows XP pro, SP2 IIS is installed and running...
7
by: Fredrik Melin | last post by:
Running a solution with about 20 sub-projects total about 150.000 lines of code. Typing code is slow (delay when typing fast). Pressing next line while debugging is slow. Pressing Ctrl-F for...
3
by: JosephByrns | last post by:
I have an asp.net application, on first load the page is slow to load. The next time I go to the page it is fast, then fast again then back to slow. The number of times it is slow seems to be time...
4
by: jonceramic | last post by:
Hi all, I have a situation I can't find any old messages or web-help on. I have a split database with a bizarre quirk. When I open up the front-end file, the main form opens up fairly quickly...
9
by: SAL | last post by:
I have an ASP.NET 2.0 app that takes about 17 seconds to load on first startup but then is very fast after that. As I understand it from some posts in June, this is caused by the loading of the App...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.