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 / .NET Framework / Scripting / August 2005

Tip: Looking for answers? Try searching our database.

which method i can use for converting a string to a number?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Alice - 16 Aug 2005 05:08 GMT
which method i can use for converting a string to a number?

x10000 thanks
Mona - 17 Aug 2005 21:50 GMT
Hi Alice,

We can use an implicit type conversion that may fail at runtime. This means
that some string values do not have an obvious analogue as a number or
Boolean.

Using explicit type conversions, which allow for lossy conversions, makes
code more reliable and much less likely to fail at runtime.

Hope this helps.

Best Regards,

Mona [Grapecity]

> which method i can use for converting a string to a number?
>
> x10000 thanks
meckdahl@yahoo.com - 30 Aug 2005 23:25 GMT
Alice,

I had problems with the conversions, too.  Here is a code snippet of my
solution:  ( I am reading power data from an instrument)

double m_dTemp, m_dCh1LastPower; //

// This bypasses conversion error that shows up,
// Error is on return value of "" (Empty sting)
if ( Double.TryParse(strReading,
    System.Globalization.NumberStyles.Float,
    null, out m_dTemp) )
{  // True on successful conversion, so use it

        m_dCh1LastPower = m_dTemp;
               // To modify and return to string
               m_dCh1LastPower = m_dCh1LastPower * 1000;
        String sFormatter = "#0.00";
               string txtNew = m_dCh1LastPower.ToString(sFormatter)
}

> Hi Alice,
>
[quoted text clipped - 14 lines]
> >
> > x10000 thanks

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.