Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / Managed C++ / November 2004

Tip: Looking for answers? Try searching our database.

using CEdit control

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
garrry - 26 Nov 2004 16:57 GMT
Here is the situation (in VisualC++6 environment):

1. some number is enterd into a CEdit window by user
2. the application has to obtain that number and do some calculations

with it (just like in Windows Calculator), therefore the result must
be

a numeric value(double, float, etc.), not a CString object like it

normally happens with CEdit.

What is better:
to convert CString to number
or
to find a way to get number strait from CEdit?

Some help, please! :cry:
Ajay Kalra - 27 Nov 2004 19:31 GMT
What is really the difference here? You can only get data from CEdit in the
form of text. Only then you can convert it to whatever you want. If it helps
you get it from CString, go for it; if not, do some other way. I suspect
converting from CString will be fine.

-----------
Ajay Kalra
ajaykalra@yahoo.com

> Here is the situation (in VisualC++6 environment):
>
[quoted text clipped - 19 lines]
>   www.GroupSrv.com
> *-----------------------*
Rodrigo Aceves - 30 Nov 2004 16:47 GMT
When you use the ClassWizard to add a new variable for the CEdit control,
there is an option where you can specify the type. It can be int, float,
double, CString, or any other you like (you may have a class that inherits
from CString or something).

You can have the variable for the CEdit control as a float, but then you
don't have much control in the way it is presented. If you want to format
the resulting number as you like, use a CString variable and the Format
method. If you don't care use it as a float (or into or double).

For reading the value the user inputs, you can do the same. Have it as a
float and so you don't need to do any type checking (it is done
automatically by VC++), or get it as a CString and convert the number using
atoi, atol or atof (integer, long or double).

Regards

> Here is the situation (in VisualC++6 environment):
>
[quoted text clipped - 19 lines]
>   www.GroupSrv.com
> *-----------------------*

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.