Este programa lo que hace es determinar el valor de la
resistencia que tienes si tienes el valor de la resistencia que buscas o el
color de la resistencia que buscas, para poder hacer esto utilizamos varios “Combobox”
para que mires que datos tienes, después se evalúa con “Case” que es otro
comparador, cual valor fue el que ingresaste, y con esto te da el valor de la
resistencia que tienes. Este programa es una compilación de los dos anteriores.
A continuación se mostrara el código que se utilizó:
Public Class Form1
Dim banda1, banda2 As Integer
Dim banda3, tolerancia As String
Private Sub Form1_Load(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
banda1 = 0
banda2 = 0
banda3 = 0
tolerancia
= 0
End Sub
Private Sub ComboBox1_SelectedIndexChanged(ByVal
sender As System.Object, ByVal e As System.EventArgs) Handles
ComboBox1.SelectedIndexChanged
Select Case ComboBox1.Text
Case "negro"
banda1 = 0
Case
"cafe"
banda1 = 1
Case
"rojo"
banda1 = 2
Case
"naranja"
banda1 = 3
Case
"amarillo"
banda1 = 4
Case
"verde"
banda1 = 5
Case
"azul"
banda1 = 6
Case
"violeta"
banda1 = 7
Case "gris"
banda1 = 8
Case "blanco"
banda1 = 9
End Select
End Sub
Private Sub
ComboBox2_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles ComboBox2.SelectedIndexChanged
Select Case ComboBox2.Text
Case "negro"
banda2 = 0
Case "cafe"
banda2 = 1
Case
"rojo"
banda2 = 2
Case
"naranja"
banda2 = 3
Case
"amarillo"
banda2 = 4
Case
"verde"
banda2 = 5
Case "azul"
banda2 = 6
Case
"violeta"
banda2 = 7
Case "gris"
banda2 = 8
Case "blanco"
banda2 = 9
End Select
End Sub
Private Sub
ComboBox3_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles ComboBox3.SelectedIndexChanged
Select Case ComboBox3.Text
Case "negro"
banda3 =
"1"
Case
"cafe"
banda3 = "10"
Case
"rojo"
banda3 = "100"
Case
"naranja"
banda3 = "1000"
Case
"amarillo"
banda3 = "10000"
Case
"verde"
banda3 = "100000"
Case
"azul"
banda3 = "1000000"
Case
"violeta"
banda3 = "10000000"
Case "gris"
banda3 = "100000000"
Case "blanco"
banda3 = "1000000000"
End Select
End Sub
Private Sub
ComboBox4_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles ComboBox4.SelectedIndexChanged
Select Case ComboBox4.Text
Case "plata"
tolerancia =
"+-10%"
Case
"dorado"
tolerancia = "+-5%"
End Select
End Sub
Private Sub Button1_Click(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Label5.Text = (banda1 &
banda2) * banda3
Label6.Text
= tolerancia
End Sub
Private Sub Button2_Click(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Select Case ComboBox5.Text
Case "0"
RectangleShape1.BackColor =
Color.Black
Case "1"
RectangleShape1.BackColor =
Color.Brown
Case "2"
RectangleShape1.BackColor =
Color.Red
Case "3"
RectangleShape1.BackColor =
Color.Orange
Case "4"
RectangleShape1.BackColor =
Color.Yellow
Case "5"
RectangleShape1.BackColor =
Color.Green
Case "6"
RectangleShape1.BackColor =
Color.Blue
Case "7"
RectangleShape1.BackColor =
Color.Violet
Case "8"
RectangleShape1.BackColor =
Color.Gray
Case "9"
RectangleShape1.BackColor =
Color.White
End Select
Select Case ComboBox6.Text
Case "0"
RectangleShape2.BackColor =
Color.Black
Case "1"
RectangleShape2.BackColor =
Color.Brown
Case "2"
RectangleShape2.BackColor =
Color.Red
Case "3"
RectangleShape2.BackColor =
Color.Orange
Case "4"
RectangleShape2.BackColor =
Color.Yellow
Case "5"
RectangleShape2.BackColor =
Color.Green
Case "6"
RectangleShape2.BackColor =
Color.Blue
Case "7"
RectangleShape2.BackColor =
Color.Violet
Case "8"
RectangleShape2.BackColor =
Color.Gray
Case "9"
RectangleShape2.BackColor =
Color.White
End Select
Select Case ComboBox7.Text
Case ""
RectangleShape3.BackColor =
Color.Black
Case "0"
RectangleShape3.BackColor =
Color.Brown
Case "00"
RectangleShape3.BackColor =
Color.Red
Case "000"
RectangleShape3.BackColor =
Color.Orange
Case "0000"
RectangleShape3.BackColor =
Color.Yellow
Case "00000"
RectangleShape3.BackColor =
Color.Green
Case "000000"
RectangleShape3.BackColor =
Color.Blue
Case "0000000"
RectangleShape3.BackColor =
Color.Violet
Case "00000000"
RectangleShape3.BackColor =
Color.Gray
Case "000000000"
RectangleShape3.BackColor =
Color.White
End Select
Select Case ComboBox8.Text
Case "5%"
RectangleShape4.BackColor =
Color.Gold
Case "10%"
RectangleShape4.BackColor =
Color.Silver
End Select
End Sub
End Class
La parte gráfica de este
programa se ve así:
11. RESISTENCIAS
3 (Combinacion de Numeros y Colores)
EL ENLACE DONDE PUEDEN DESCARGAR ESTE PROGRAMA ES:
No hay comentarios:
Publicar un comentario
Su comentario seria de gran ayuda para nosotros.