Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 826151
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T03:22:09+00:00 2026-05-15T03:22:09+00:00

must you convert from strings to double? if so. how? Are there functions for

  • 0

must you convert from strings to double? if so. how?

Are there functions for trig that will accept textbox string data as is?

Is there a way to pull the data from the textbox as a numeric value, not as a string?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T03:22:10+00:00Added an answer on May 15, 2026 at 3:22 am

    must you convert from strings to double?

    Yes.

    if so. how?

    The C++ way is to use the string streams; in particular, you’ll probably want to use istringstream. A viable alternative is to follow the C way, i.e. use sscanf with the appropriate format specifier (“%f”).

    Another C++ option is to use the boost lexical_cast, but starting to use boost just for lexical_cast is a bit overkill in my opinion.

    Example with istringstream:

    #include <sstream>
    // ...
    std::istringstream strParser(yourString);
    double yourDouble;
    strParser>>yourDouble;
    if(strParser.fail())
    {
        // the string couldn't be converted to a double
    }
    else if(!strParser.eof())
    {
        // the string hasn't been fully consumed; this may or may not be a problem, depending on your needs
    }
    

    Are there functions for trig that will accept textbox string data as is?

    AFAIK no, there’s no need of them (although you can write them quite easily).

    Is there a way to pull the data from the textbox as a numeric value, not as a string?

    The WinAPIs provide a handful of such “convenience functions” for use in dialogs, but the only one I can recall that provides such help is GetDlgItemInt, which, as the name may suggest, works only for integers.

    Addendum

    I see now that you are using C++/CLI (you mentioned System::String): well, you should have said that, this changes the options quite a bit.

    In the managed world, your best option is to use the Double::Parse method; to catch bad-formatted strings, you should either catch the exceptions thrown by Double::Parse or call Double::TryParse before calling Double::Parse.

    Addendum bis

    Uh, I forgot, since you’re using the .NET Framework probably it should be better to use the .NET trigonometric functions (class System.Math).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

how to convert number(price) from 1.00 to 000000000100 total all string must 12 digits
I get a ISO-8859-1-encoded string from an exernal DLL, and I must use it
I have some Fortran 77 source files that I'm trying to convert from a
I I have a timezone taken from a user that must be converted into
I have been given some 'reports' from another piece of software that contains data
I want to convert a large 64 bit value from decimal or hex string
I'm looking for an easy way to convert all variables and function names from
How can I convert a string from a lowercase to uppercase with all possible
I wanted to write two one-line functions which will trim white spaces from left
This time I want to get an array-list element from strings.xml and convert it

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.