Visual Basic 6 Conversion of Temperature with a Scroll Bar

Visual Basic 6 Conversion of Temperature with a Scroll Bar

In this post we will discuss another funny as well as interesting program in Visual Basic i.e, making temperature scale with Scroll Bar where both the Fahrenheit and Celsius will change at a same time .

Scroll bar control is vary good tools for the programmers of Visual basic.It is vary essay to use,It is of two form horizontal and vertical.We can place it in form according to our needs or choices.

We have done our design in such a way
We took four labels only and a scroll option.

Changed Property

                  caption :Fahrenheit
                  caption: Celsius

Problem Statement:
     Write a program in Vb to convert Fahrenheit and Celsius at a same time using scroll bar.

Source Code:
     Private Sub Vscroll1_Change( )
         Dim C as Integer
         Dim F as Integer
            Label1.Caption = VScroll1.Value
              C = Val(Label1.Caption)
              F = 9/5*C + 32
            Label2.Caption =  F
      End Sub


  • The source code is written under Change event of VScroll. 
  • Dim is used to declared a variable.
  • Val function is used to change a string to numeric.

Thanks for reading this post.Hope this will help you.
If you have any doubt comment bellow , we will be happy to help you.


Post a Comment