Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

ComboBox and calculations

satsocsatsoc Posts: 19Member
hi guys,
i was wondering if we could create a program with a ComboBox that includes km,m,cm and if we choose km for example it converts them to mm.

Any ideas how it can be done?(1km = 1000m,etc...)

Comments

  • KDivad LeahcimKDivad Leahcim Posts: 3,948Member
    : hi guys,
    : i was wondering if we could create a program with a ComboBox that includes km,m,cm and if we choose km for example it converts them to mm.
    :
    : Any ideas how it can be done?(1km = 1000m,etc...)

    Easy, as long as you know the calculations:
    [code]
    Combo1.AddItem "km -> mm (1:1000)"
    Combo1.AddItem "mm -> km (1000:1)"

    Private Sub Combo1_Click()

    Select Case Combo1.ListIndex
    Case 0
    Text2.Text = CStr(Val(Text1.text) * 1000)
    Case 1
    Text2.Text = CStr(Val(Text1.text) / 1000)
    End Select

    End Sub
    [/code]
    Hope this helps!
Sign In or Register to comment.