Siento abusar nuevamente de vuestra ayuda. Estoy tratando de traducir un programa que hice en VB6, pero dada la forma de funcionar de gambas (3.0), estoy encontrando bastantes zancadillas en el camino.
Me gustaría saber cómo puedo hacer para que al pinchar sobre un item de un combobox obtenga el índice de dicho item
Cuando hay un solo combobox, no tengo problemas :
Pero, ¿cómo lo hago cuando son varios los combobox, es decir tengo un array de combobox?
Os pongo en antecedentes mostrando el código que tengo ya pasado:
He de comentar que los textos de los label y las opciones del combobox las cargo con variables contenidas en un fichero externo .conf
' declaramos la variable de clase que nos permitirá tener el fichero .conf donde le digamos
Public mysettings As Settings
' declaramos como objetos para luego manejar los arrays de labels y de combobox
Public un_objeto As Object
Public otro_objeto As Object
Public Sub Form_Open()
' declaramos todas la variables según su tipo
Dim count As Integer
Dim vara As Integer
Dim xasi As Integer
' centramos el formulario en la pantalla
Me.Center
' ponemos título al formulario
Me.Title = "xxxxx 1.0"
' indicamos el lugar donde la nueva variable settings puede encontrar el archivo xxxx.conf
mysettings = New Settings(Application.path &/ "xxxx.conf")
' aquí se cargan los textos desde el fichero xxxx.conf a los labels
For Each un_objeto In Me.Controls
If un_objeto Is Label Then un_objeto.Text = mysettings["opciones/value[" & un_objeto.tag & "]"]
Next
' aquí se cargan las opciones desde el archivo .conf a todos los combobox del form
For Each otro_objeto In Me.Controls
If otro_objeto Is ComboBox Then
otro_objeto.text = "??"
vara = (mysettings["combo" & otro_objeto.tag & "/count"])
For xasi = 0 To vara - 1
otro_objeto.add(mysettings["combo" & otro_objeto.tag & "/value" & xasi])
Next
End If
Next
End
Public mysettings As Settings
' declaramos como objetos para luego manejar los arrays de labels y de combobox
Public un_objeto As Object
Public otro_objeto As Object
Public Sub Form_Open()
' declaramos todas la variables según su tipo
Dim count As Integer
Dim vara As Integer
Dim xasi As Integer
' centramos el formulario en la pantalla
Me.Center
' ponemos título al formulario
Me.Title = "xxxxx 1.0"
' indicamos el lugar donde la nueva variable settings puede encontrar el archivo xxxx.conf
mysettings = New Settings(Application.path &/ "xxxx.conf")
' aquí se cargan los textos desde el fichero xxxx.conf a los labels
For Each un_objeto In Me.Controls
If un_objeto Is Label Then un_objeto.Text = mysettings["opciones/value[" & un_objeto.tag & "]"]
Next
' aquí se cargan las opciones desde el archivo .conf a todos los combobox del form
For Each otro_objeto In Me.Controls
If otro_objeto Is ComboBox Then
otro_objeto.text = "??"
vara = (mysettings["combo" & otro_objeto.tag & "/count"])
For xasi = 0 To vara - 1
otro_objeto.add(mysettings["combo" & otro_objeto.tag & "/value" & xasi])
Next
End If
Next
End
Perdonad que no utilice las etiquetas de "code" del foro (me manejo mal)
Gracias de antemano.