2015r1 and Parse addition

37439 All: Added Parse function to Integer, Double, and Single. This function acts more like Val/CDbl did, in that it’s more lenient at parsing and will not raise exceptions.

Any more information on this? I’m not seeing it yet in any (…) tab option
and adding ‘parse’ gives a syntax error.
I’m wondering if this is better than CDbl or how to use it.

You use it like this:

dim d as double = Double.Parse(aTextVariable)

I see. Any advantage to doing this as opposed to CDbl(aTextVariable)?

CDbl is the OLD framework and will not work in the new one. The new framework does not have Variant. In it’s place is Auto which is has NO implicit conversions. Hence the need for FromText and Parse.

I talked a little about the new framework at http://www.bkeeneybriefs.com/2014/12/new-xojo-framework-thoughts/ and in particular the problem with FromText methods. Glad they created the Parse methods.

I see. Thanks for taking the time to write that article.
I hadn’t run across that exception using CDbl("") so was unaware of FromText methods.
I did just run into exception throwing from non-existent cells in ListBox though.
Anyway, so my first thought that the reason we went from CDbl to Double.Parse was because someone’s brother-in-law
owned a keyboard factory was wrong. Glad to hear that :slight_smile:

You miss the point. If you are using CDbl you are using the old (existing) framework. You can continue to use it for many years to come. Perhaps forever. It will probably never go away.

The FromText and Parse methods are only needed when you use the new framework. Currently that is only required for iOS. The new framework will eventually come to web, console and then desktop. The new and old frameworks can co-mingle in many places.

CDBl does NOT throw exceptions - ever. And that’s actually part of the problem. It makes assumptions that we’re all used to using. The FromText methods throw exceptions if it can’t convert while the new Parse methods will make the same (sometimes incorrect) assumptions.

Oh, okay. It’s not the first or last time I’ll miss a point.
I didn’t really know what framework you were talking about.

heh. Don’t stress. You’ll learn all this stuff with time.

double parse expects text if i want convert to double two textboxes and multiply them how should do?

Xojo says textbox.text is string not text i’m confused

Text automatically converts to String. Going the other way, you need to call the String class’ ToText method.