473,378 Members | 1,446 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,378 software developers and data experts.

Very stupid question part 2

Thanks Folks,

Now I need to go the other way. That is, have a textBox display a
representation of a double precision number. I have tried (amoung other
things):

textBox2->Text=F.ToString;
all resulting in errors unintelegible by me.

--
mark b
Apr 5 '07 #1
3 961
In article <42**********************************@microsoft.co m>,
=?Utf-8?B?bWFyaw==?= <ma**@discussions.microsoft.comwrote:
>Now I need to go the other way. That is, have a textBox display a
representation of a double precision number. I have tried (amoung other
things):
textBox2->Text=F.ToString;
Once again, the tried and true method in C/C++ is sprintf.
Don't knock it until you've tried it. For example:

char tempStr[128];
sprintf_s(tempStr, "%g", value);

Simple, portable (well, except for the _s part), and has more
possible options than you can shake a stick at.

Nathan Mates
--
<*Nathan Mates - personal webpage http://www.visi.com/~nathan/
# Programmer at Pandemic Studios -- http://www.pandemicstudios.com/
# NOT speaking for Pandemic Studios. "Care not what the neighbors
# think. What are the facts, and to how many decimal places?" -R.A. Heinlein
Apr 5 '07 #2
If you want a C++ way (and not C (like Nathan Mates' solution) or .Net way), you can use stringstream or wstringstream (sprintf is
faster but is not type safe). See interpret_cast in Kevlin Henney's paper (Valued Conversions,
http://www.two-sdg.demon.co.uk/curbr...nversions.pdf). Also see lexical_cast (from the same author) in boost
libraries for an updated and more complete version of interpret_cast (http://www.boost.org/libs/conversion/lexical_cast.htm). These
converter templates are very flexible, simple and useful.
Regards
--
Cholo Lennon
Bs.As.
ARG

"mark" <ma**@discussions.microsoft.comescribió en el mensaje news:42**********************************@microsof t.com...
Thanks Folks,

Now I need to go the other way. That is, have a textBox display a
representation of a double precision number. I have tried (amoung other
things):

textBox2->Text=F.ToString;
all resulting in errors unintelegible by me.

--
mark b

Apr 5 '07 #3

"mark" <ma**@discussions.microsoft.comwrote in message
news:42**********************************@microsof t.com...
Thanks Folks,

Now I need to go the other way. That is, have a textBox display a
representation of a double precision number. I have tried (amoung other
things):

textBox2->Text=F.ToString;
ToString is a function, not a property. The () are not optional in C++.
textBox2->Text=F.ToString();
Apr 5 '07 #4

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

Similar topics

119
by: rhat | last post by:
I heard that beta 2 now makes ASP.NET xhtml compliant. Can anyone shed some light on what this will change and it will break stuff as converting HTML to XHTML pages DO break things. see,...
5
by: raz | last post by:
Greetings all. I apologize for what is almost certainly a stupid question, but I can't figure this out, and have no more time for head bashing... The short version: what is the appropriate...
2
by: Dutchy | last post by:
Hi there, After spending several hours trying all I could imagine and search for in Google I gave up. In a continuous form I want to sort the choosen column by clicking the header (label) of...
18
by: vashwath | last post by:
Hi all, As per our coding rule, a line should not have more than 80 characters. When accessing a structure elements which are deeply nested, we are not able follow this rule. To acheive this Can...
21
by: Steve | last post by:
Hi, I have a form containing a lot of various forms objects (about 120-150). It takes about 10 minutes for the solution to load (only one project). If I modify the corresponding .h file and...
5
by: BethInAK | last post by:
Thank you in advance for any possible help you have to offer, before I pull my hair out! I am incredibly frustrated attempting to learn asp.net. Its really pissing me off. Please help. ...
2
by: Ron Weldy | last post by:
I read that you don't need .cs files to deploy but I suppose if you are trying to reconstruct someone's work, you will need these files. Is that correct?
50
by: diffuser78 | last post by:
I have just started to learn python. Some said that its slow. Can somebody pin point the issue. Thans
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.