Connecting Tech Pros Worldwide Help | Site Map

celsius to fahrenheit

  #1  
Old April 14th, 2009, 10:05 PM
Newbie
 
Join Date: Apr 2009
Posts: 1
how to write a program in visual basic 2008 that displays a Celsius to Fahrenheit conversion table. Entries in the table should range from –40 to 40 degrees Celsius in increments of 5 degrees. Use the formula f = (9/5)*c + 32 to convert Celsius temperatures to Fahrenheit.
  #2  
Old April 15th, 2009, 08:11 AM
debasisdas's Avatar
Moderator
 
Join Date: Dec 2006
Location: Bangalore ,India
Posts: 7,485
Provided Answers: 1

re: celsius to fahrenheit


What you have tried so far ?

simply add two text boxes
accept value from one
after the calculation display on the other.
  #3  
Old April 15th, 2009, 11:39 AM
MrMancunian's Avatar
Expert
 
Join Date: Jul 2008
Location: Utrecht, The Netherlands
Posts: 264

re: celsius to fahrenheit


Quote:
Originally Posted by mattwhy50 View Post
how to write a program in visual basic 2008 that displays a Celsius to Fahrenheit conversion table. Entries in the table should range from –40 to 40 degrees Celsius in increments of 5 degrees. Use the formula f = (9/5)*c + 32 to convert Celsius temperatures to Fahrenheit.
This sounds like a school assignment to me, so I won't give you a full solution, but I think you should do something with a loop from -40 to 40 with a step 5, a datagridview with two columns and a function that converts the loopvalue to a fahrenheit value.

Good luck!

Steven
  #4  
Old April 16th, 2009, 03:30 PM
iam_clint's Avatar
Forum Leader
 
Join Date: Jul 2006
Location: Oklahoma
Posts: 1,077

re: celsius to fahrenheit


Even though this looks like a homework assignment some people learn out of example.
Expand|Select|Wrap|Line Numbers
  1.         For c = 0 To 20 Step 2 'makes a loop that starts at 0 and increments by 2 until it reaches 20
  2.             Dim Row As New DataGridViewRow 'declares a new row
  3.             Dim Cell As DataGridViewCell 'sets variable cell as a cell
  4.             Cell = New DataGridViewTextBoxCell() 'creates a new cell
  5.             Cell.Value = c 'sets the value of the cell
  6.             Row.Cells.Add(Cell) 'adds the cell to the row
  7.  
  8.             Cell = New DataGridViewTextBoxCell() 'creates a new cell
  9.             Cell.Value = (1.8 * c) + 32 'does the math (9/5) = (1.8 * c) + 32
  10.             Row.Cells.Add(Cell) 'adds the cell to the row
  11.             DataGridView1.Rows.Add(Row) 'adds the row to the datagridview
  12.         Next
  13.  

This will go from 0 to 20 in c and convert to f every 2 so 0 2 4 6 8 -> so on
You should be able to get a good start off of it.
Reply


Similar Threads
Thread Thread Starter Forum Replies Last Post
Logical error in program to convert celsius to farenheit. kipj77 answers 4 September 22nd, 2008 12:01 PM
program converting Celsius to Fahrenheit zelmila19 answers 5 April 15th, 2008 03:56 AM
Need help with celcius to fahrenheit converter code sigkill9 answers 1 January 23rd, 2008 05:55 AM