Is there a way to work with numbers in a textbox as the text changes? I have a app I am trying to build & I want to do math with the numbers entered in a few text boxes but I don't want to have to click a button to calculate it. I would like it to work as the text is changed. I can use get or lost focus but then I need something like on error resume next so it wont error if there is blank text.
Just wondering
Just wondering
--
Test before calculating with the is a number Math block.
--
but I don't want to have to click a button to calculate it.
use a cock component to do the calculation
I figured out the is a number block it works the same as If isnumeric in vb. But trying to get my math equations into the blocks is kicking my but.
--
This is what I am trying to do but not sure yet if I can with this?
Tf = TextBox1.Text
RH = TextBox2.Text
P = TextBox3.Text
P = P * 33.863867
TC = (Tf - 32) * (5 / 9)
tk = TC + 273.16
Es = 6.11 * 10.0# ^ (7.5 * TC / (237.7 + TC))
E1 = RH * Es / 100
Tv = tk / (1 - (E1 / P) * (1 - 0.622))
Tv = Tv - 273.16
Tv = (9 / 5) * Tv + 32
Tv = Tv + 460
psta = P / 33.863867
x = (17.326 * psta) / Tv
Da = 145366 * (1 - (x ^ 0.235))
dap = psta - E1
z = 1 - (0.01 * RH)
TextBox5.Text = Math.Round(Da, 2)
--
Wow. Thanks Taifun. That was a big help. One more question and I will try to stop bugging you and get this figured out. Is there a way to make temporary fields like TC, TK, ect or will have to add hidden fields to hold them? For example is there a way to say Dim TC as single and then TC = 100 and then use TC in my math or will I have to add a hidden label or something to hold TC ?
-- Is there a way to make temporary fields like TC, TK, ect or will have to add hidden fields to hold them?
what about using variables?
A very good way to learn App Inventor is to read the free Inventor's Manual here in the AI2 free online eBook http://www.appinventor.org/b ook2 ... the links are at the bottom of the Web page. The book 'teaches' users how to program with AI2 blocks.
There is a free programming course here http://www.appinventor.or g/content/CourseInABox/Intro and the aia files for the projects in the book are here: http://www.appinventor.org/bo okFiles
How to do a lot of basic things with App Inventor are described here: http://www.appinventor.org/co ntent/howDoYou/eventHandling .
Also do the tutorials http://appinventor.mit.edu/ explore/ai2/tutorials.html to learn the basics of AppInventor, then try something and follow the
Top 5 Tips: How to learn App Inventor
You will not find a tutorial, which does exactly what you are looking for. But doing the tutorials (not only reading a little bit) help you to understand, how things are working. This is important and this is the first step to do.
Look in particular for local variables.
--
댓글 없음:
댓글 쓰기