wenas necesito hacer 1 programa al que se le te pida o un numero o unos colores que sean valores de resistencias o los colore de las resistencias i mediante 2 botones uno que utilice el numero por ejempli pones el numero 220 i salga el dibujo de una resistencia con los colores rojo rojo marron y 3 text box que te ponga el nombre de los colores i otro boton que haga lo contrario introduciendo en los texbox de los colores el rojo rojo marron i te aparezca la resistencia con esos colores i en el textbox del numero aparezca el 220. los nombres de los colores pueden ser introducidos tanto en castellano como en ingles. Aparte tambien unos botones de seleccion que sean uno que ponga castellano i otro ingles por si quieres que al introducir el numero te de el nombre de los colores en ingles o en castellano. las instrucciones que se deben utilizar son los IF, FOR, rutinas y bucles.
Mucas gracias recuerdo que sea lenguaje visual basic.
Aqui no hacemos ejercicios si quieres que te ayudemos, danos lo que llevas hecho.
la cosa esta en que nose como empezarlo. con una mano en como empezar intentare poderlo terminar i si ay algo que no se cmo acer lo preguntare i una vez lo tenga acabado lo posteare por si alguien lo necesita.
Ayudate de esta imagen:
(http://robophantom.files.wordpress.com/2008/05/cod_resist1.jpg)
Y luego podrías hacer un array de dos dimensiones e ir consultando los valores, ¿me explico?
ya tengo exo a mitad del programa me falta la otra mitad que es el 2o boton el de color a valor que es poniendo yo rojo rojo marron que en el numero salga el 220 i enla resistencia salgan los colores. la parte de poner el numero i que me digalos colres en letras i los colores en la resistencia ya esta i es el siguiente.
es tan largo xq esta puesto para catalan castellano e ingles con que me pongais en castellano ya me encargo yo deponerlo en ingles i catala.
Private Sub Command2_Click()
Dim val As Double
If Text1.Text <> "" Then
If Option2.Value = True Then
val = CDbl(Text1.Text)
cifras = Len(Text1.Text)
Select Case cifras
Case 2
Text4.Text = "Negro"
Line5.BorderColor = &H80000008
Case 3
Text4.Text = "Marrón"
Line5.BorderColor = &H4080&
val = val / 10
Case 4
Text4.Text = "Rojo"
Line5.BorderColor = &HFF&
val = val / 100
Case 5
Text4.Text = "Naranja"
Line5.BorderColor = &H80FF&
val = val / 1000
Case 6
Text4.Text = "Amarillo"
Line5.BorderColor = &H80FFFF
val = val / 10000
Case 7
Text4.Text = "Verde"
Line5.BorderColor = &HFF00&
val = val / 100000
Case 8
Text4.Text = "Azul"
Line5.BorderColor = &HFF0000
val = val / 1000000
Case 9
Text4.Text = "Violeta"
Line5.BorderColor = &HFF00FF
val = val / 10000000
End Select
Select Case val
Case 10
Text2.Text = "Marrón"
Line3.BorderColor = &H4080&
Text3.Text = "Negro"
Line4.BorderColor = &H80000008
Case 11
Text2.Text = "Marrón"
Line3.BorderColor = &H4080&
Text3.Text = "Marrón"
Line4.BorderColor = &H4080&
Case 12
Text2.Text = "Marrón"
Line3.BorderColor = &H4080&
Text3.Text = "Rojo"
Line4.BorderColor = &HFF&
Case 13
Text2.Text = "Marrón"
Line3.BorderColor = &H4080&
Text3.Text = "Naranja"
Line4.BorderColor = &H80FF&
Case 15
Text2.Text = "Marrón"
Line3.BorderColor = &H4080&
Text3.Text = "Verde"
Line4.BorderColor = &HFF00&
Case 16
Text2.Text = "Marrón"
Line3.BorderColor = &H4080&
Text3.Text = "Azul"
Line4.BorderColor = &HFF0000
Case 18
Text2.Text = "Marrón"
Line3.BorderColor = &H4080&
Text3.Text = "Gris"
Line4.BorderColor = &HC0C0C0
Case 20
Text2.Text = "Rojo"
Line3.BorderColor = &HFF&
Text3.Text = "Negro"
Line4.BorderColor = &H80000008
Case 22
Text2.Text = "Rojo"
Line3.BorderColor = &HFF&
Text3.Text = "Rojo"
Line4.BorderColor = &HFF&
Case 24
Text2.Text = "Rojo"
Line3.BorderColor = &HFF&
Text3.Text = "Amarillo"
Line4.BorderColor = &H80FFFF
Case 27
Text2.Text = "Rojo"
Line3.BorderColor = &HFF&
Text3.Text = "Violeta"
Line4.BorderColor = &HFF00FF
Case 33
Text2.Text = "Naranja"
Line3.BorderColor = &H80FF&
Text3.Text = "Naranja"
Line4.BorderColor = &H80FF&
Case 36
Text2.Text = "Naranja"
Line3.BorderColor = &H80FF&
Text3.Text = "Azul"
Line4.BorderColor = &HFF0000
Case 39
Text2.Text = "Naranja"
Line3.BorderColor = &H80FF&
Text3.Text = "Blanco"
Line4.BorderColor = &HFFFFFF
Case 43
Text2.Text = "Amarillo"
Line3.BorderColor = &H80FFFF
Text3.Text = "Naranja"
Line4.BorderColor = &H80FF&
Case 47
Text2.Text = "Amarillo"
Line3.BorderColor = &H80FFFF
Text3.Text = "Violeta"
Line4.BorderColor = &HFF00FF
Case 51
Text2.Text = "Verde"
Line3.BorderColor = &HFF00&
Text3.Text = "Marrón"
Line4.BorderColor = &H4080&
Case 56
Text2.Text = "Verde"
Line3.BorderColor = &HFF00&
Text3.Text = "Azul"
Line4.BorderColor = &HFF0000
Case 62
Text2.Text = "Azul"
Line3.BorderColor = &HFF0000
Text3.Text = "Rojo"
Line4.BorderColor = &HFF&
Case 68
Text2.Text = "Azul"
Line3.BorderColor = &HFF0000
Text3.Text = "Gris"
Line4.BorderColor = &HC0C0C0
Case 75
Text2.Text = "Violeta"
Line3.BorderColor = &HFF00FF
Text3.Text = "Verde"
Line4.BorderColor = &HFF00&
Case 82
Text2.Text = "Gris"
Line3.BorderColor = &HC0C0C0
Text3.Text = "Rojo"
Line4.BorderColor = &HFF&
Case 91
Text2.Text = "Blanco"
Line3.BorderColor = &HFFFFFF
Text3.Text = "Marrón"
Line4.BorderColor = &H4080&
Case Else
MsgBox ("No existe la resistencia, valor incorrecto")
Text4.Text = ""
Text3.Text = ""
Text2.Text = ""
End Select
Else
If option1.value = true then
val = CDbl(Text1.Text)
cifras = Len(Text1.Text)
Select Case cifras
Case 2
Text4.Text = "Negre"
Line5.BorderColor = &H80000008
Case 3
Text4.Text = "Marró"
Line5.BorderColor = &H4080&
val = val / 10
Case 4
Text4.Text = "Vermell"
Line5.BorderColor = &HFF&
val = val / 100
Case 5
Text4.Text = "Taronja"
Line5.BorderColor = &H80FF&
val = val / 1000
Case 6
Text4.Text = "Groc"
Line5.BorderColor = &H80FFFF
val = val / 10000
Case 7
Text4.Text = "Verd"
Line5.BorderColor = &HFF00&
val = val / 100000
Case 8
Text4.Text = "Blau"
Line5.BorderColor = &HFF0000
val = val / 1000000
Case 9
Text4.Text = "Violeta"
Line5.BorderColor = &HFF00FF
val = val / 10000000
End Select
Select Case val
Case 10
Text2.Text = "Marró"
Line3.BorderColor = &H4080&
Text3.Text = "Negre"
Line4.BorderColor = &H80000008
Case 11
Text2.Text = "Marró"
Line3.BorderColor = &H4080&
Text3.Text = "Marró"
Line4.BorderColor = &H4080&
Case 12
Text2.Text = "Marró"
Line3.BorderColor = &H4080&
Text3.Text = "Vermell"
Line4.BorderColor = &HFF&
Case 13
Text2.Text = "Marró"
Line3.BorderColor = &H4080&
Text3.Text = "Taronja"
Line4.BorderColor = &H80FF&
Case 15
Text2.Text = "Marró"
Line3.BorderColor = &H4080&
Text3.Text = "Verd"
Line4.BorderColor = &HFF00&
Case 16
Text2.Text = "Marró"
Line3.BorderColor = &H4080&
Text3.Text = "Blau"
Line4.BorderColor = &HFF0000
Case 18
Text2.Text = "Marró"
Line3.BorderColor = &H4080&
Text3.Text = "Gris"
Line4.BorderColor = &HC0C0C0
Case 20
Text2.Text = "Vermell"
Line3.BorderColor = &HFF&
Text3.Text = "Negre"
Line4.BorderColor = &H80000008
Case 22
Text2.Text = "Vermell"
Line3.BorderColor = &HFF&
Text3.Text = "Vermell"
Line4.BorderColor = &HFF&
Case 24
Text2.Text = "Vermell"
Line3.BorderColor = &HFF&
Text3.Text = "Groc"
Line4.BorderColor = &H80FFFF
Case 27
Text2.Text = "Vermell"
Line3.BorderColor = &HFF&
Text3.Text = "Violeta"
Line4.BorderColor = &HFF00FF
Case 33
Text2.Text = "Taronja"
Line3.BorderColor = &H80FF&
Text3.Text = "Taronja"
Line4.BorderColor = &H80FF&
Case 36
Text2.Text = "Taronja"
Line3.BorderColor = &H80FF&
Text3.Text = "Blau"
Line4.BorderColor = &HFF0000
Case 39
Text2.Text = "Taronja"
Line3.BorderColor = &H80FF&
Text3.Text = "Blanco"
Line4.BorderColor = &HFFFFFF
Case 43
Text2.Text = "Groc"
Line3.BorderColor = &H80FFFF
Text3.Text = "Taronja"
Line4.BorderColor = &H80FF&
Case 47
Text2.Text = "Groc"
Line3.BorderColor = &H80FFFF
Text3.Text = "Violeta"
Line4.BorderColor = &HFF00FF
Case 51
Text2.Text = "Verd"
Line3.BorderColor = &HFF00&
Text3.Text = "Marró"
Line4.BorderColor = &H4080&
Case 56
Text2.Text = "Verd"
Line3.BorderColor = &HFF00&
Text3.Text = "Blau"
Line4.BorderColor = &HFF0000
Case 62
Text2.Text = "Blau"
Line3.BorderColor = &HFF0000
Text3.Text = "Vermell"
Line4.BorderColor = &HFF&
Case 68
Text2.Text = "Blau"
Line3.BorderColor = &HFF0000
Text3.Text = "Gris"
Line4.BorderColor = &HC0C0C0
Case 75
Text2.Text = "Violeta"
Line3.BorderColor = &HFF00FF
Text3.Text = "Verd"
Line4.BorderColor = &HFF00&
Case 82
Text2.Text = "Gris"
Line3.BorderColor = &HC0C0C0
Text3.Text = "Vermell"
Line4.BorderColor = &HFF&
Case 91
Text2.Text = "Blanc"
Line3.BorderColor = &HFFFFFF
Text3.Text = "Marró"
Line4.BorderColor = &H4080&
Case Else
MsgBox ("No existeix la resistència, valor incorrecte")
Text4.Text = ""
Text3.Text = ""
Text2.Text = ""
End Select
Else
If option3.value = true then
val = CDbl(Text1.Text)
cifras = Len(Text1.Text)
Select Case cifras
Case 2
Text4.Text = "Black"
Line5.BorderColor = &H80000008
Case 3
Text4.Text = "Brown"
Line5.BorderColor = &H4080&
val = val / 10
Case 4
Text4.Text = "Red"
Line5.BorderColor = &HFF&
val = val / 100
Case 5
Text4.Text = "Orange"
Line5.BorderColor = &H80FF&
val = val / 1000
Case 6
Text4.Text = "Yellow"
Line5.BorderColor = &H80FFFF
val = val / 10000
Case 7
Text4.Text = "Green"
Line5.BorderColor = &HFF00&
val = val / 100000
Case 8
Text4.Text = "Blue"
Line5.BorderColor = &HFF0000
val = val / 1000000
Case 9
Text4.Text = "Violet"
Line5.BorderColor = &HFF00FF
val = val / 10000000
End Select
Select Case val
Case 10
Text2.Text = "Brown"
Line3.BorderColor = &H4080&
Text3.Text = "Black"
Line4.BorderColor = &H80000008
Case 11
Text2.Text = "Brown"
Line3.BorderColor = &H4080&
Text3.Text = "Brown"
Line4.BorderColor = &H4080&
Case 12
Text2.Text = "Brown"
Line3.BorderColor = &H4080&
Text3.Text = "Red"
Line4.BorderColor = &HFF&
Case 13
Text2.Text = "Brown"
Line3.BorderColor = &H4080&
Text3.Text = "Orange"
Line4.BorderColor = &H80FF&
Case 15
Text2.Text = "Brown"
Line3.BorderColor = &H4080&
Text3.Text = "Green"
Line4.BorderColor = &HFF00&
Case 16
Text2.Text = "Brown"
Line3.BorderColor = &H4080&
Text3.Text = "Blue"
Line4.BorderColor = &HFF0000
Case 18
Text2.Text = "Brown"
Line3.BorderColor = &H4080&
Text3.Text = "Grey"
Line4.BorderColor = &HC0C0C0
Case 20
Text2.Text = "Red"
Line3.BorderColor = &HFF&
Text3.Text = "Black"
Line4.BorderColor = &H80000008
Case 22
Text2.Text = "Red"
Line3.BorderColor = &HFF&
Text3.Text = "Red"
Line4.BorderColor = &HFF&
Case 24
Text2.Text = "Red"
Line3.BorderColor = &HFF&
Text3.Text = "Yellow"
Line4.BorderColor = &H80FFFF
Case 27
Text2.Text = "Red"
Line3.BorderColor = &HFF&
Text3.Text = "Violet"
Line4.BorderColor = &HFF00FF
Case 33
Text2.Text = "Orange"
Line3.BorderColor = &H80FF&
Text3.Text = "Orange"
Line4.BorderColor = &H80FF&
Case 36
Text2.Text = "Orange"
Line3.BorderColor = &H80FF&
Text3.Text = "Blue"
Line4.BorderColor = &HFF0000
Case 39
Text2.Text = "Orange"
Line3.BorderColor = &H80FF&
Text3.Text = "Whiteo"
Line4.BorderColor = &HFFFFFF
Case 43
Text2.Text = "Yellow"
Line3.BorderColor = &H80FFFF
Text3.Text = "Orange"
Line4.BorderColor = &H80FF&
Case 47
Text2.Text = "Yellow"
Line3.BorderColor = &H80FFFF
Text3.Text = "Violet"
Line4.BorderColor = &HFF00FF
Case 51
Text2.Text = "Green"
Line3.BorderColor = &HFF00&
Text3.Text = "Brown"
Line4.BorderColor = &H4080&
Case 56
Text2.Text = "Green"
Line3.BorderColor = &HFF00&
Text3.Text = "Blue"
Line4.BorderColor = &HFF0000
Case 62
Text2.Text = "Blue"
Line3.BorderColor = &HFF0000
Text3.Text = "Red"
Line4.BorderColor = &HFF&
Case 68
Text2.Text = "Blue"
Line3.BorderColor = &HFF0000
Text3.Text = "Grey"
Line4.BorderColor = &HC0C0C0
Case 75
Text2.Text = "Violet"
Line3.BorderColor = &HFF00FF
Text3.Text = "Green"
Line4.BorderColor = &HFF00&
Case 82
Text2.Text = "Grey"
Line3.BorderColor = &HC0C0C0
Text3.Text = "Red"
Line4.BorderColor = &HFF&
Case 91
Text2.Text = "White"
Line3.BorderColor = &HFFFFFF
Text3.Text = "Brown"
Line4.BorderColor = &H4080&
Case Else
MsgBox ("The resistance don't exist, incorrect value")
Text4.Text = ""
Text3.Text = ""
Text2.Text = ""
End Select
End Sub
Private Sub Option1_Click()
Label1.Caption = "CODI DE COLORS"
Label1.AutoSize = True
Label2.Caption = "Valor"
Label3.Caption = "Ohms"
Command1.Caption = "SORTIR"
Command2.Caption = "Valor a Color"
Command3.Caption = "Color a Valor"
Option1.Caption = "Català"
Option2.Caption = "Castellà"
Option3.Caption = "Anglès"
End Sub
Private Sub Option2_Click()
Label1.Caption = "CODIGO DE COLORES"
Label1.AutoSize = True
Label2.Caption = "Valores"
Label2.AutoSize = True
Label3.Caption = "Ohmios"
Label3.AutoSize = True
Command1.Caption = "SALIR"
Command2.Caption = "Valor a Color"
Command3.Caption = "Color a Valor"
Option1.Caption = "Catalan"
Option2.Caption = "Castellano"
Option3.Caption = "Inglés"
End Sub
Private Sub Option3_Click()
Label1.Caption = "COLOURS CODE"
Label1.AutoSize = True
Label2.Caption = "Value"
Label2.AutoSize = True
Label3.Caption = "Ohmios"
Label3.AutoSize = True
Command1.Caption = "EXIT"
Command2.Caption = "Value to Colour"
Command3.Caption = "Colour to value"
Option1.Caption = "Catalan"
Option2.Caption = "Spanish"
Option3.Caption = "English"
End Sub
GRACIAS
tengo lo de los colores a numero ya exo pero tengo 1 problema que de colores a numero tambien tiene que estar limitado a cierto numero de resistencias que son las mismas que se an limitado para el otro boton de numero a color.
Tengo esto podriais ayudarme para que si pongo unos colores que el numero de resistencia que tiene que dar no esta en la lista de posibles ponga que el valor no es correcto. Pongo solo el castellano porque asi es mas corto i es lo mismo para los demas idiomas.
If Text2.Text <> "" Or Text3.Text <> "" Or Text4 <> "" Then
Dim primero As String
Dim segundo As String
Dim tercero As String
primero = Text2.Text
segundo = Text3.Text
tercero = Text4.Text
Text1.Text = ""
If Option2.Value = True Then
Select Case LCase(primero)
Case "negro"
Text1.Text = Text1.Text & "0"
Line3.BorderColor = &H80000008
Case "marrón"
Text1.Text = Text1.Text & "1"
Line3.BorderColor = &H4080&
Case "rojo"
Text1.Text = Text1.Text & "2"
Line3.BorderColor = &HFF&
Case "naranja"
Text1.Text = Text1.Text & "3"
Line3.BorderColor = &H80FF&
Case "amarillo"
Text1.Text = Text1.Text & "4"
Line3.BorderColor = &H80FFFF
Case "verde"
Text1.Text = Text1.Text & "5"
Line3.BorderColor = &HFF00&
Case "azul"
Text1.Text = Text1.Text & "6"
Line3.BorderColor = &HFF0000
Case "violeta"
Text1.Text = Text1.Text & "7"
Line3.BorderColor = &HFF00FF
Case "gris"
Text1.Text = Text1.Text & "8"
Line3.BorderColor = &HC0C0C0
Case "blanco"
Text1.Text = Text1.Text & "9"
Line3.BorderColor = &HFFFFFF
End Select
Select Case LCase(segundo)
Case "negro"
Text1.Text = Text1.Text & "0"
Line4.BorderColor = &H80000008
Case "marrón"
Text1.Text = Text1.Text & "1"
Line4.BorderColor = &H4080&
Case "rojo"
Text1.Text = Text1.Text & "2"
Line4.BorderColor = &HFF&
Case "naranja"
Text1.Text = Text1.Text & "3"
Line4.BorderColor = &H80FF&
Case "amarillo"
Text1.Text = Text1.Text & "4"
Line4.BorderColor = &H80FFFF
Case "verde"
Text1.Text = Text1.Text & "5"
Line4.BorderColor = &HFF00&
Case "azul"
Text1.Text = Text1.Text & "6"
Line4.BorderColor = &HFF0000
Case "violeta"
Text1.Text = Text1.Text & "7"
Line4.BorderColor = &HFF00FF
Case "gris"
Text1.Text = Text1.Text & "8"
Line4.BorderColor = &HC0C0C0
Case "blanco"
Text1.Text = Text1.Text & "9"
Line4.BorderColor = &HFFFFFF
End Select
Select Case LCase(tercero)
Case "negro"
Text1.Text = Text1.Text
Line5.BorderColor = &H80000008
Case "marrón"
Text1.Text = Text1.Text * 10
Line5.BorderColor = &H4080&
Case "rojo"
Text1.Text = Text1.Text * 100
Line5.BorderColor = &HFF&
Case "naranja"
Text1.Text = Text1.Text * 1000
Line5.BorderColor = &H80FF&
Case "amarillo"
Text1.Text = Text1.Text * 10000
Line5.BorderColor = &H80FFFF
Case "verde"
Text1.Text = Text1.Text * 100000
Line5.BorderColor = &HFF00&
Case "azul"
Text1.Text = Text1.Text * 1000000
Line5.BorderColor = &HFF0000
Case Else
MsgBox ("No existe la resistencia, valor incorrecto")
Text4.Text = ""
Text3.Text = ""
Text2.Text = ""
End Select
es esto. tengo que limitarlo a estos valores: 10, 11, 12, 13, 15, 16, 18, 20, 22, 24, 27, 30, 33, 36, 39, 43, 47, 51, 56, 62, 68, 75, 82, 91 i sus multiplos hasta 91.000.000 yo supongo que es cuando ya tiene 2 numeros desde alli comprovar que esos 2 numeros estan entre estos xo nose como hacerlo.
Gracias