Visual Basic - Conversion de Unidades BOND

Life is soft - evento anual de software empresarial
 
Vista:

Conversion de Unidades BOND

Publicado por Sebastian Alonso (2 intervenciones) el 11/12/2023 00:33:30
Conversion de Velocidades
Ten en cuenta que las conversiones de converiones se deben repetir en el codigo que comprende tu comboBox y tu TextBox ligados.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
Private Sub TextBox1_TextChanged(sender As Object, e As EventArgs) Handles TextBox1.TextChanged
        If TextBox1.Text <> "" Then
            If ComboBox2.Text = "Ton/h" Then
                T = TextBox1.Text / 60
                Label7.Text = T & " Ton/min"
            ElseIf ComboBox2.Text = "Kg/h" Then
                T = TextBox1.Text * 0.0000183
                Label7.Text = T & " Ton/min"
            ElseIf ComboBox2.Text = "Kg/min" Then
                T = TextBox1.Text / 1000
                Label7.Text = T & " Ton/min"
            ElseIf ComboBox2.Text = "Lb/h" Then
                T = TextBox1.Text * 0.00000753
                Label7.Text = T & " Ton/min"
            ElseIf ComboBox2.Text = "Lb/min" Then
                T = TextBox1.Text * 0.00045
                Label7.Text = T & " Ton/min"
            ElseIf ComboBox2.Text = "Oz/h" Then
                T = TextBox1.Text * 0.000000518
                Label7.Text = T & " Ton/min"
            ElseIf ComboBox2.Text = "Oz/min" Then
                T = TextBox1.Text * 0.00003113
                Label7.Text = T & " Ton/min"
            ElseIf ComboBox2.Text = "Ton/min" Then
                T = TextBox1.Text
                Label7.Text = T & " Ton/min"
            Else
                MsgBox("error valor incorrecto")
            End If
        Else
            Label7.Text = ""
        End If
    End Sub

Ejemplo de aplicacion del codigo en una ComboBox
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
Private Sub ComboBox2_SelectedIndexChanged(sender As Object, e As EventArgs) Handles ComboBox2.SelectedIndexChanged
        ComboBox2.DropDownStyle = ComboBoxStyle.DropDownList
        If TextBox1.Text <> "" Then
            If ComboBox2.Text = "Ton/h" Then
                T = TextBox1.Text / 60
                Label7.Text = T & " Ton/min"
            ElseIf ComboBox2.Text = "Kg/h" Then
                T = TextBox1.Text * 0.0000183
                Label7.Text = T & " Ton/min"
            ElseIf ComboBox2.Text = "Kg/min" Then
                T = TextBox1.Text / 1000
                Label7.Text = T & " Ton/min"
            ElseIf ComboBox2.Text = "Lb/h" Then
                T = TextBox1.Text * 0.00000753
                Label7.Text = T & " Ton/min"
            ElseIf ComboBox2.Text = "Lb/min" Then
                T = TextBox1.Text * 0.00045
                Label7.Text = T & " Ton/min"
            ElseIf ComboBox2.Text = "Oz/h" Then
                T = TextBox1.Text * 0.000000518
                Label7.Text = T & " Ton/min"
            ElseIf ComboBox2.Text = "Oz/min" Then
                T = TextBox1.Text * 0.00003113
                Label7.Text = T & " Ton/min"
            ElseIf ComboBox2.Text = "Ton/min" Then
                T = TextBox1.Text
                Label7.Text = T & " Ton/min"
            Else
                MsgBox("error valor incorrecto")
            End If
        Else
            Label7.Text = ""
        End If
    End Sub

Conversion de longitudes
Ten en cuenta que las conversiones de converiones se deben repetir en el codigo que comprende tu comboBox y tu TextBox ligados.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
Private Sub TextBox3_TextChanged(sender As Object, e As EventArgs) Handles TextBox3.TextChanged
        If TextBox3.Text <> "" Then
            If ComboBox4.Text = "m" Then
                Dp = TextBox3.Text * 3.2808
                Label10.Text = Dp & " ft"
            ElseIf ComboBox4.Text = "in" Then
                Dp = TextBox3.Text / 12
                Label10.Text = Dp & " ft"
            ElseIf ComboBox4.Text = "yd" Then
                Dp = TextBox3.Text * 3
                Label10.Text = Dp & " ft"
            ElseIf ComboBox4.Text = "cm" Then
                Dp = TextBox3.Text * 0.0328
                Label10.Text = Dp & " ft"
            ElseIf ComboBox4.Text = "mm" Then
                Dp = TextBox3.Text * 0.00328
                Label10.Text = Dp & " ft"
            ElseIf ComboBox4.Text = "micrometros" Then
                Dp = TextBox3.Text * 0.00000328
                Label10.Text = Dp & " ft"
            ElseIf ComboBox4.Text = "ft" Then
                Dp = TextBox3.Text
                Label10.Text = Dp & " ft"
            Else
                MsgBox("error valor incorrecto")
            End If
        Else
            Label10.Text = ""
        End If
    End Sub

Ecuacion de Bond
1
2
3
4
5
6
7
8
9
10
If ComboBox5.Text = "Hp" Then
            Dim valorFormateado As String = P.ToString("N4")
            Label6.Text = valorFormateado
        ElseIf ComboBox5.Text = "Watts" Then
            Dim valorFormateado As String = (P * 745.7).ToString("N4")
            Label6.Text = valorFormateado
        ElseIf ComboBox5.Text = "Libra fuerza" Then
            Dim valorFormateado As String = (P * 550).ToString("N4")
            Label6.Text = valorFormateado
        End If
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder