#1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2003
    Posts
    2
    Rep Power
    0

    (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.
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2001
    Location
    Dublin
    Posts
    413
    Rep Power
    14
    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
  4. #3
  5. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2003
    Posts
    2
    Rep Power
    0
    thanks so much man. I got it figured out thanks to your example.

IMN logo majestic logo threadwatch logo seochat tools logo