April 1st, 2003, 10:18 AM
-
(Question)display results in a table
I'm working on a program that basically converts fahrenheit to celsius and vice versa. I have it all complete but I am stuck on one thing. There are two text boxes and you enter a temperature range like 20 as the low temp. and 30 as the high temp. Say you are converting from fahrenheit to celsius When you click calculate it will calculate all of the INTEGERS between 20 and 30 and display them in a table like this
Fahrenheit ---------------------- Celsius
20 ------------------------- converted temp. whatever it may be.
21 ------------------------- converted temp. whatever it may be.
22 ------------------------- etc.
23
24
etc.
the results I want to be displayed in a text box or label, whichever one is better. I've tried both but can't figure how to display the results in a table like this. Any suggestions or tips? Thanks. =) Like I said I have everything else completed except displaying the results in a table like above.
April 1st, 2003, 11:57 AM
-
you could use any one of a number of options ... textbox, list box, grid and so on
textbox is simplest but not the most visually appealing
for textbox just keep appending the next row data as follows:
Code:
dim tableStr as string, i as integer, mn as integer, mx as integer
tableStr=""
let mn=cInt(tMin.value): let mx=cInt(tMax.value)'maybe add some validation ... ensure mn<mx, for example
for i=mn to mx
tableStr=tableStr & cStr(i)
tableStr=tableStr & " ---- "
tableStr=tableStr & cStr((i-32)/1.8) 'from the top of my head ... probably not right!
tableStr=tableStr & vbNewLine
next i
let tableStr=left$(tableStr,len(tableStr)-len(vbnewline)) 'optionally remove trailing new line
let tCalculations.value=tableStr
April 1st, 2003, 05:38 PM
-
thanks so much man. I got it figured out thanks to your example.