473,625 Members | 2,999 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 1265
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*****@pacbel l.net> wrote in message
news:a1******** **********@news svr25.news.prod igy.com...
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*****@pacbel l.net> wrote in message
news:a1******** **********@news svr25.news.prod igy.com...
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*********@ho tmail.com> wrote in message
news:eM******** ******@TK2MSFTN GP11.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*****@pacbel l.net> wrote in message
news:a1******** **********@news svr25.news.prod igy.com...
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
1987
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 server application using VB.NET that will be communicating with a device...the format that it uses can't be changed. The format is something like this: Device: <length><message> Server: <ack> (two null bytes, or "zero length")
12
2628
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 and has been in place for several years without any performance problems. Recently I added a couple of fields to the output of the view, and it became very slow when scrolling. When just opened in the database window, the linked view takes about...
8
2880
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 it took to go to a record was very slow. The go to mechanism was a box that the user typed the index value into a combo box, with very simple code attached: with me.RecordsetClone .FindFirst " = " & me.cboGoTo If Not .NoMatch Then Me.Bookmark...
3
2876
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 MyGrid.DataBind() Once the records are loaded, to handle the next, previous button is too slow. I have in the same screen OptionsBox and everytime I click in any option I show some text fields in the screen. Anything the user does is very slow. When...
6
8568
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 fine All SQL Servers I am referring to share a small (10 computers or so) LAN with a 100MB Switch. No other computers on the LAN exhibit this problem.
7
1446
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 quick find is rediculous slow. Everything is slow. Running Exe is fine though This is on a HP Workstation machine with Xeon 3GHz (HT Enabled) with 2 GB
3
1241
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 based, for example: First Load at Time 0s: (10 seconds to load page) Second Load at Time 11s (<1s to load page) Third Load at Time 13s (<1s to load page) Fourth Load at Time 15s (<1s to load page) First Load at Time 17s: (10 seconds to load...
4
1982
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 (~2-3 seconds.) If I copy my front end in Windows Explorer, the first time I open it, it's 2-3 seconds also.
9
13030
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 Domain. We have both Cold Fusion and ASP.NET apps on this server and the Cold Fusion apps do not display such slowness on their first start up of the day. Is there a way to improve the load times of ASP.NET apps? I'm having to justify to my boss...
0
8692
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8354
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8497
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7182
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6116
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5570
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
2621
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1802
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1499
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.