Ver Mensaje Individual
  #6 (permalink)  
Antiguo 24/01/2009, 22:36
UnlimiT3D
 
Fecha de Ingreso: enero-2009
Mensajes: 2
Antigüedad: 15 años, 3 meses
Puntos: 0
Respuesta: ayuda con checkbox

Cada ves que presiones en un check te dira el valor en un msgbox..

Cita:
Dim Valor As Byte
Private Sub Check1_Click()
Call SumarValor
MsgBox Valor
End Sub
Private Sub SumarValor()
Valor = 0
If Check1.Value = 1 Then
Valor = Valor + 2
End If
If Check2.Value = 1 Then
Valor = Valor + 2
End If
If Check3.Value = 1 Then
Valor = Valor + 2
End If
If Check4.Value = 1 Then
Valor = Valor + 2
End If
If Check5.Value = 1 Then
Valor = Valor + 2
End If
If Check6.Value = 1 Then
Valor = Valor + 2
End If
End Sub

Private Sub Check2_Click()
Call SumarValor
MsgBox Valor
End Sub

Private Sub Check3_Click()
Call SumarValor
MsgBox Valor
End Sub

Private Sub Check4_Click()
Call SumarValor
MsgBox Valor
End Sub

Private Sub Check5_Click()
Call SumarValor
MsgBox Valor
End Sub

Private Sub Check6_Click()
Call SumarValor
MsgBox Valor
End Sub
y este es si quieres q se llame sumarvalor desde un command mas cortito xd
Cita:
Dim Valor As Byte

Private Sub SumarValor()
Valor = 0
If Check1.Value = 1 Then
Valor = Valor + 2
End If
If Check2.Value = 1 Then
Valor = Valor + 2
End If
If Check3.Value = 1 Then
Valor = Valor + 2
End If
If Check4.Value = 1 Then
Valor = Valor + 2
End If
If Check5.Value = 1 Then
Valor = Valor + 2
End If
If Check6.Value = 1 Then
Valor = Valor + 2
End If
End Sub

Private Sub Command1_Click()
Call SumarValor
MsgBox Valor
End Sub