473,473 Members | 1,838 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Format Problem

Hello,

I'm using VC++ 7.0 .NET. It seems that the "%d" and "%f" format parameters
are not supported anymore. Following code does not work:

StatusLabel->Text = String::Format ("Reading %d bytes (%0.1f Kb/s)",
__box(lBytes), __box (dTransferRate));

If I used this code with VC++ 6.0 and MFC it worked without any problems? Do
you have an idea how to solve this?
Nov 17 '05 #1
4 2016
Manfred Huber wrote:
Hello,

I'm using VC++ 7.0 .NET. It seems that the "%d" and "%f" format
parameters are not supported anymore. Following code does not work:

StatusLabel->Text = String::Format ("Reading %d bytes (%0.1f Kb/s)",
__box(lBytes), __box (dTransferRate));

If I used this code with VC++ 6.0 and MFC it worked without any
problems? Do you have an idea how to solve this?


You can't possibly have used this code with VC6 or MFC, since what you've
posted here is .NET code.

I think you've got the C standard library routines {v}{s|f}printf confused
with System::Format.

-cd
Nov 17 '05 #2
> You can't possibly have used this code with VC6 or MFC, since what you've
posted here is .NET code.


In VC6 with MFC i used
CString str;
str.Format ("Reading %d bytes (%0.1f Kb/s)", lBytes,dTransferRate);

What I wanted to say is that the .NET does not support the %d and %o.1f
parameters anymore.
Nov 17 '05 #3
Manfred Huber wrote:
You can't possibly have used this code with VC6 or MFC, since what
you've posted here is .NET code.
In VC6 with MFC i used
CString str;
str.Format ("Reading %d bytes (%0.1f Kb/s)", lBytes,dTransferRate);

What I wanted to say is that the .NET does not support the %d and
%o.1f parameters anymore.


String::Format is completely different from CString.Format (which uses
vsnprintf internally).

See

http://msdn.microsoft.com/library/de...Formatting.asp
http://msdn.microsoft.com/library/de...ngOverview.asp
http://msdn.microsoft.com/library/de...matstrings.asp

For information on how to use System::String::Format.

You original example of
StatusLabel->Text = String::Format ("Reading %d bytes (%0.1f Kb/s)",
__box(lBytes), __box (dTransferRate));


should be written:

StatusLabel->Text = String::Format("Reading {0} bytes ({1:0.0}Kb/s)",
__box(lBytes), __box (dTransferRate));
HTH

-cd
Nov 17 '05 #4
Thank you for the fast help. It worked.
Nov 17 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Bernd Lambertz | last post by:
I have a problem with bcp and format files. We changed our databases from varchar to nvarchar to support unicode. No problems so fare with that. It is working fine. But now I need a format...
2
by: amith | last post by:
hi I have written javascript for comparing two dates in US format and finding out whether the start date is greater than the end date and vice versa. In this attempt i have instantiated the...
1
by: Laurence Neville | last post by:
This is regarding a change in the Short Date format under Hebrew Regional Settings, that has caused huge problems in our ASP web application. The change appears to have been introduced sometime...
6
by: Dario Di Bella | last post by:
Hi all, we have the following urgent issue affecting our development team. Initially we had one particular workstation that failed executing queries on a DB2 database, raising an invalid date...
8
by: Ishbel Kargar | last post by:
Since upgrading from old laptop (Windows 98) to new laptop (Windows XP), my mail-merge letters are doing strange things with date formats. For instance, my reminder letter for lapsed subs carries...
1
by: Wayne Aprato | last post by:
I have a client who is running several Access 97 databases that I have written for them. They are about to upgrade to Access 2003. Is the default file format of Access 2003 still Access 2000 the...
5
by: Ataru Morooka | last post by:
Hi, my table has to have a column with the months names (january, february...). When I order it by month it is ordered alphabetically and that's not what I need. Reading this ng I found someone...
2
by: Pat | last post by:
Here is my problem that I am having with a current project. I went and backed up all my hard drives to DVD's. After backing up the drives, I used a batch file to get all the file names from the...
9
by: insomniux | last post by:
Hi, I am having a problem with formatting the default value of a date field. It has been discussed earlier in many topics, but still I cannot solve the problem. What's happening: I have various...
3
by: karthikla | last post by:
Hi Experts, Could you please help me on how to get access 2002 file format exactly while doing conversion from Access 97 file format by DBEngine.CompactDatabase() function? Code: Private...
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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...
1
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...
0
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...
0
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,...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
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...

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.