Ver Mensaje Individual
  #11 (permalink)  
Antiguo 03/01/2006, 12:53
Avatar de David
David
Moderador
 
Fecha de Ingreso: abril-2005
Ubicación: In this planet
Mensajes: 15.720
Antigüedad: 20 años
Puntos: 839
Cita:
Iniciado por emilio21
no encuentro que hacer...

los datos en la base de datos están guardados de la siguiente manera: si seleccionó los checks A1, B2, C3, B4 entonces a la base de datos va así:

A1-B2-C3-B4

con un - por el medio.

Entonces yo quiero que los checks con captions A1, B2, C3, B4, se seleccionen cuando el usuario quiera modificar los datos que seleccionó.

Como hago para leer los datos que estan unidos con -?
Aquí el Código:
Código:
 
Function GetIndex(ByVal Cadena As String, ByVal Separador As String, ByVal Index As Integer) As String
Dim UlParada As Integer
Dim Buscar As Integer
Dim IIndex As Integer
If Right(Cadena, 1) <> Separador Then Cadena = Cadena & Separador
UlParada = 1
Do
    Buscar = InStr(UlParada, Cadena, Separador)
    If Buscar = 0 Then Exit Do
    If IIndex = Index Then
        GetIndex = Mid$(Cadena, UlParada, Buscar - UlParada)
        Exit Do
    End If
    IIndex = IIndex + 1
    UlParada = Buscar + 1
Loop
End Function
Sub SelectChecks(ByVal StrChecks As String)
Dim Index As String
Dim Count As Integer
Do
    Index = GetIndex(StrChecks, "-", Count)
    If Index = "" Then Exit Sub
    Count = Count + 1
    FindCheckByCaption(Index).Value = 1
Loop
End Sub
Function FindCheckByCaption(ByVal iCaption As String) As CheckBox
Dim iControls As Integer
For iControls = 0 To Me.Controls.Count - 1
    If UCase(Me.Controls(iControls).Caption) = UCase(iCaption) Then
        If TypeOf Me.Controls(iControls) Is CheckBox Then
            Set FindCheckByCaption = Me.Controls(iControls)
            Exit Function
        End If
    End If
Next iControls
End Function
Private Sub Command1_Click()
SelectChecks "check1-check3"
End Sub
__________________
Por favor, antes de preguntar, revisa la Guía para realizar preguntas.

Última edición por David; 04/01/2006 a las 10:51