How to Convert Degree from Kelvin to Another in VB 6 Programming?

Saturday, August 1, 2009 ·

In this posting I will write a simple VB programming tips "How to convert degree from Kelvin into Celcius, Fahrenheit and Rheamur" using VB6 programming. Let's go on to the simple tips.
We have three previous conversion formulas (Celcius base) as follow in the erlier postings:
Fahrenheit = ( Celcius X 1.8 ) + 32
Rheamur = Celcius X 0.8
Kelvin = Celcius + 273.15


From previous formulas we got another three formulas with Kelvin degree basis as the following:
Celcius = Kelvin - 273.15
Fahrenheit = ( ( Kelvin - 273.15 ) X 1.8 ) + 32
Rheamur = ( Kelvin - 273.15 ) X 0.8


Let's implement these formulas in a simple VB6 programming.
First you should create a screen design like below image (just a simple screen design):
Design Simple VB6 Program - Degree Conversion


















How to create this screen design? Follow below instructions for the tips.
  • Open your Visual Basic6 program software
  • Create a project for example Project1
  • Create a standard form for example Form1
  • Create 5 labels for example Label1, Label2, Label3, Label4, Label5
  • Create 4 text boxes for example Text1, Text2, Text3, Text4
  • Click Label1 object so properties of Label1 appears
  • Change its Caption into "Degree Conversion", and change its Font Size into 14
  • Click Label2, and change its Caption into "Kelvin"
  • Like Label2 do with the same way for Label3, Label4, Label5 and change their Captions into "Celius", "Fahrenheit" and "Rheamur"
  • Click Command1, change its Caption into "Convert", and change its Name into "cmdConvert"
  • Click Text1, delete its Text, and change its Name into "txtKelvin"
  • Do with the same way for Text2, Text3, Text4 and change their Names into "txtCelcius", "txtFahrenheit", and "txtRheamur"
  • Double click cmdConvert (the command button with Caption "Convert") to create a Sub cmdConvert_Click()
  • Write down the following program coding in the Sub cmdConvert_Click() area
    'conversion process
    txtCelcius.Text = Val(txtKelvin.Text) - 273.15
    txtRheamur.Text = (Val(txtKelvin.Text) - 273.15) * 0.8
    txtFahrenheit.Text = ((Val(txtKelvin.Text) - 273.15) * 1.8) + 32


    Your program will look like below coding:
    Private Sub cmdConvert_Click()
    'conversion process
    txtCelcius.Text = Val(txtKelvin.Text) - 273.15
    txtRheamur.Text = (Val(txtKelvin.Text) - 273.15) * 0.8
    txtFahrenheit.Text = ((Val(txtKelvin.Text) - 273.15) * 1.8) + 32
    End Sub



    Now the time to test your program.
  • Run your program by clicking Start button on your VB Toolbar
  • Type a number for example 373.15 in "Kelvin" text box
  • Click command Convert
  • Look at the results on Celcius, Fahrenheit and Rheamur text box, they should be 100, 212 and 80

    Look at below image, and your result should look like it.
    Simple VB Program Degree Conversion from Kelvin

    What about your idea? Any comment?


  • 3 comments:

    Free Clip of Tips said...
    August 4, 2009 at 6:59 PM  

    Hi,
    Thank you for your visit.

    Anonymous said...
    August 4, 2009 at 7:38 PM  

    Thanks for post. It’s really imformative stuff.
    I really like to read.Hope to learn a lot and have a nice experience here! my best regards guys!
    --
    rockstarbabu
    --

    seo jaipur--seo jaipur

    Free Clip of Tips said...
    August 4, 2009 at 9:55 PM  

    Thank you for visiting my blog.

    Post a Comment