hens

I am a novice and i'm really new to VB, what I am tryin to do is create an engineering conversion program that accepts multiple selection from 2 combobox with different options. ie, celsius to farenheit, meters to feet, etc., then ouputs the result to a textbox. I am having problems gettin started, not sure whether to use case and if so, how do i get started. i'm also using a button name Convert to do my conversion after i've entered a value in a textbox and make my 2 selections from the two comboboxes.

any help would be greatly appreciated.

thanks

Hens



Re: Visual Basic Language two combobox in the same code

yangxiao_MSFT

Hi Hens,

Can you clarify the question a bit -- you want to perform two or more different conversions on the same input value If this is so, you will get one result for each conversion.





Re: Visual Basic Language two combobox in the same code

hens

I will only perform one conversion, for example if I wanted to convert Btu to horsepower-hrs then I would type in one textbox 10,000, select from the first drop down list select Btu, then from the second,select horsepower-hrs and the result would be displayed in another textbox next to the second drop down list.

I have all the formula for these calculations with me its just a matter of getting them on the screen, again i am only using one button to perform the math/calculation, so, no matter which two items i select this one button will do all the math. I hope this helped to clear up some of the confusion, sorry.

Hens





Re: Visual Basic Language two combobox in the same code

hsivaram

Hi Hens

try this.........

Public Class Form1

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
cmb1.Items.Add("celsius")
cmb1.Items.Add("Farhen")
cmb1.Items.Add("dollar")
cmb1.Items.Add("rupees")
cmb2.Items.Add("celsius")
cmb2.Items.Add("Farhen")
cmb2.Items.Add("dollar")
cmb2.Items.Add("rupees")
End Sub

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
btnfn()
End Sub
Sub btnfn()
If cmb1.SelectedItem = "celsius" And cmb2.SelectedItem = "Farhen" Then
TextBox2.Text = TextBox1.Text * 32
ElseIf cmb1.SelectedItem = "Farhen" And cmb2.SelectedItem = "celsius" Then
TextBox2.Text = TextBox1.Text / 32
ElseIf cmb1.SelectedItem = "dollar" And cmb2.SelectedItem = "rupees" Then
TextBox2.Text = TextBox1.Text * 42
ElseIf cmb1.SelectedItem = "rupees" And cmb2.SelectedItem = "dollar" Then
TextBox2.Text = TextBox1.Text / 42
Else
MsgBox("select different items in cmb box")
End If
End Sub
End Class





Re: Visual Basic Language two combobox in the same code

hens

I've been tryin this code and it has been working

thanks