
Duda sobre variable a botones
Publicado por Jose maria (4 intervenciones) el 06/10/2013 13:41:59
Buenas
Resulta que tengo que hacer un programa en el que en un formulario tengo 169 botones, cada botón tiene un nombre "silla1, silla2,.......silla169" cuando pulso cualquier botón habilita un listbox y solo se debe seleccionar uno de las nueve opciones.
una vez seleccionada una opción necesito que devuelva una serie de actuaciones al botón que lo activo.
Ejemplo:
169 botones------Cada botón nombre Silla1
Cuando se pulsa cualquier botón activa listbox con 9 opciones
cuando se elige una opción que cambie el botón de un color determinado y deshabilitado.
Boton 1 con nombre Silla1, Silla2,.... Silla169
Unidades.Visible = True
Listbox con nombre Prueba
If Prueba.SelectedItem = "1" Then
silla(n).BackColor = Color.LimeGreen
silla(n).Enabled = False
Prueba.Visible = False
ElseIf Prueba.SelectedItem = "2" Then
silla.BackColor = Color.Aqua
silla.Enabled = False
Prueba.Visible = False
ElseIf Prueba.SelectedItem = "3" Then
silla.BackColor = Color.LightSkyBlue
silla.Enabled = False
Prueba.Visible = False
ElseIf Prueba.SelectedItem = "4" Then
silla.BackColor = Color.Tomato
silla.Enabled = False
Prueba.Visible = False
ElseIf Prueba.SelectedItem = "5" Then
silla.BackColor = Color.Khaki
silla.Enabled = False
Prueba.Visible = False
ElseIf Prueba.SelectedItem = "6" Then
silla.BackColor = Color.Silver
silla.Enabled = False
Prueba.Visible = False
ElseIf Prueba.SelectedItem = "7" Then
silla.BackColor = Color.LightCoral
silla.Enabled = False
Prueba.Visible = False
ElseIf Prueba.SelectedItem = "8" Then
silla.BackColor = Color.RoyalBlue
silla.Enabled = False
Prueba.Visible = False
ElseIf Prueba.SelectedItem = "9" Then
silla.BackColor = Color.SaddleBrown
silla.Enabled = False
Prueba.Visible = False
ElseIf Prueba.SelectedItem = "10" Then
silla.BackColor = Color.Black
silla.Enabled = False
Prueba.Visible = False
End If
He intendado poner una variable n como String,
pero cuando selecciono la opción del listbox no devuelve acciones al botón que hizo la llamada.
Gracias.
Resulta que tengo que hacer un programa en el que en un formulario tengo 169 botones, cada botón tiene un nombre "silla1, silla2,.......silla169" cuando pulso cualquier botón habilita un listbox y solo se debe seleccionar uno de las nueve opciones.
una vez seleccionada una opción necesito que devuelva una serie de actuaciones al botón que lo activo.
Ejemplo:
169 botones------Cada botón nombre Silla1
Cuando se pulsa cualquier botón activa listbox con 9 opciones
cuando se elige una opción que cambie el botón de un color determinado y deshabilitado.
Boton 1 con nombre Silla1, Silla2,.... Silla169
Unidades.Visible = True
Listbox con nombre Prueba
If Prueba.SelectedItem = "1" Then
silla(n).BackColor = Color.LimeGreen
silla(n).Enabled = False
Prueba.Visible = False
ElseIf Prueba.SelectedItem = "2" Then
silla.BackColor = Color.Aqua
silla.Enabled = False
Prueba.Visible = False
ElseIf Prueba.SelectedItem = "3" Then
silla.BackColor = Color.LightSkyBlue
silla.Enabled = False
Prueba.Visible = False
ElseIf Prueba.SelectedItem = "4" Then
silla.BackColor = Color.Tomato
silla.Enabled = False
Prueba.Visible = False
ElseIf Prueba.SelectedItem = "5" Then
silla.BackColor = Color.Khaki
silla.Enabled = False
Prueba.Visible = False
ElseIf Prueba.SelectedItem = "6" Then
silla.BackColor = Color.Silver
silla.Enabled = False
Prueba.Visible = False
ElseIf Prueba.SelectedItem = "7" Then
silla.BackColor = Color.LightCoral
silla.Enabled = False
Prueba.Visible = False
ElseIf Prueba.SelectedItem = "8" Then
silla.BackColor = Color.RoyalBlue
silla.Enabled = False
Prueba.Visible = False
ElseIf Prueba.SelectedItem = "9" Then
silla.BackColor = Color.SaddleBrown
silla.Enabled = False
Prueba.Visible = False
ElseIf Prueba.SelectedItem = "10" Then
silla.BackColor = Color.Black
silla.Enabled = False
Prueba.Visible = False
End If
He intendado poner una variable n como String,
pero cuando selecciono la opción del listbox no devuelve acciones al botón que hizo la llamada.
Gracias.
Valora esta pregunta


0