In the previous posting you have learnt a simple VB programming tips "How to convert degree from Fahrenheit into another one in VB6 programming". Now we will learn another simple VB programming tips "How to convert degree / temperature from Rheamur into another one", so the base degree is Rheamur, and will be converted into Celcius, Fahrenheit and Kelvin. We have three previous conversion formulas (Celcius base) as follow:
Fahrenheit = ( Celcius X 1.8 ) + 32
Rheamur = Celcius X 0.8
Kelvin = Celcius + 273.15
From these formulas, now we can generate new three other formulas (Rheamur base) as the following:
Celcius = Rheamur / 0.8
Fahrenheit = ( ( Rheamur / 0.8 ) X 1.8 ) + 32
Kelvin = ( Rheamur / 0.8 ) + 273.15
Now, let's implement above formulas into a simple VB6 programming. Let's go on to the following simple VB programming tips!
So your screen design should look like below image:
'to clear the content of text boxes
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
Text4.Text = ""
'conversion process
'Text1 represents Rheamur
'Text2 represents Celcius
'Text3 represents Fahrenheit
'Text4 represents Kelvin
Text2.Text = Val(Text1.Text) / 0.8
Text3.Text = ((Val(Text1.Text) / 0.8) * 1.8) + 32
Text4.Text = (Val(Text1.Text) / 0.8) + 273.15
So your program will look like below listing:
Private Sub Command1_Click()
'conversion process
'Text1 represents Rheamur
'Text2 represents Celcius
'Text3 represents Fahrenheit
'Text4 represents Kelvin
Text2.Text = Val(Text1.Text) / 0.8
Text3.Text = ((Val(Text1.Text) / 0.8) * 1.8) + 32
Text4.Text = (Val(Text1.Text) / 0.8) + 273.15
End Sub
Private Sub Form_Load()
'to clear the content of text boxes
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
Text4.Text = ""
End Sub
Ok, your program's finish. Test your program by clicking Start button on your VB toolbar to know whether your program working properly or not.
If the results are 100 in Text2 (Celcius), 212 in Text3 (Fahrenheit), and 373.15 in Text4 (Kelvin), it means that your program is correct and working properly.
Look at below image for your illustration.
It is very easy and very simple isn't it? Would you like to try it? Ok, in the next posting I'll write another simple tips with VB6 programming. See you in the next posting!
How to Convert Degree from Rheamur to Another in VB 6 Programming?
Subscribe to:
Post Comments (Atom)
Labels
- Stop Dreaming Start Action (1)
- Table of Contents (1)
- VB6 Programming (36)
- VB6 Sample Program (16)
0 comments:
Post a Comment