Real Software Forums

The forum for Real Studio and other Real Software products.
[ REAL Software Website | Board Index ]
It is currently Sat Sep 21, 2019 4:32 am
xojo

All times are UTC - 5 hours




Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: Basic Math
PostPosted: Wed May 18, 2011 9:34 pm 
Offline

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
 Profile  
Reply with quote  
 Post subject: Re: Basic Math
PostPosted: Thu May 19, 2011 2:03 am 
Offline

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 double
a = 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
 Profile  
Reply with quote  
 Post subject: Re: Basic Math
PostPosted: Fri May 20, 2011 1:35 am 
Offline

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


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC - 5 hours


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

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group