# Real Software Forums

The forum for Real Studio and other Real Software products.
[ REAL Software Website | Board Index ]
 It is currently Tue Aug 11, 2020 5:49 am

 All times are UTC - 5 hours

 Page 1 of 1 [ 3 posts ]
 Print view Previous topic | Next topic
Author Message
 Post subject: Basic MathPosted: Wed May 18, 2011 9:34 pm

Joined: Wed May 18, 2011 9:24 pm
Posts: 4
Location: Australia
Hi,

I've just started with RealBasic and was wondering how I would go about making a simple calculator where you input 3 different numerical imputs, the program then does the calculations based on this formula : 10xAx(b-c)=Answer (where a,b,c are the inputs.) I have previous experience with Vb.net, if that helps.

Here is a link to an image of the Window/form:
http://www.lcnmrc.com/lcnmrc.com/Rocket_Flight_Caculator.html

Thanks

Top

 Post subject: Re: Basic MathPosted: Thu May 19, 2011 2:03 am

Joined: Fri Jan 06, 2006 3:21 pm
Posts: 12388
Location: Portland, OR USA
The first thing you need is to get the values from the textfields as numbers. The value typed into the field is available as a string in TextField.Text. You can convert a string to a number with CDbl(). So your code will look something like
`dim a, b, c, answer as doublea = CDbl(TextField1.Text)b = CDbl(TextField2.Text)c = CDbl(TextField3.Text)answer = 10 * a * (b - c)`

Now you need to display the answer somewhere. "Displaying" anything requires a string. You can convert a number to a string with Format().
`TextField4.Text = Format(answer, "#")`

Refer to the documentation for additional details.

Top

 Post subject: Re: Basic MathPosted: Fri May 20, 2011 1:35 am

Joined: Wed May 18, 2011 9:24 pm
Posts: 4
Location: Australia
Thank you sooooo much

Top

 Display posts from previous: All posts1 day7 days2 weeks1 month3 months6 months1 year Sort by AuthorPost timeSubject AscendingDescending
 Page 1 of 1 [ 3 posts ]

 All times are UTC - 5 hours

 You cannot post new topics in this forumYou cannot reply to topics in this forumYou cannot edit your posts in this forumYou cannot delete your posts in this forum

Search for:
 Jump to:  Select a forum ------------------ General    General    Getting Started    Networking    Databases    Visual Basic to REAL Studio Conversion    Games    Plugins    Tips    Web Control SDK Platform Specific    Windows    Macintosh    Linux    Web Other Topics    Announcements    Off-Topic    Third Party Add-ons