leadergl
25-09-2004, 08:31
Raga ho un problema con questo codice...devo impostare il valore di molte checkbox ad 1 appena clicco su un'altra checkbox....solo che nella Private Sub ModP2k nn riesco a gestire l'array di checkbox...come faccio?
Private Sub ModP2k(chk As CheckBox, MaxIndex As Integer)
If CheckAll.Value = 1 Then
For iindex = 0 To MaxIndex
chk(iindex).Value = 1
Next iindex
Else
For iindex = 0 To MaxIndex
chk(iindex).Value = 1
Next iindex
End If
End Sub
Private Sub CheckAll_Click()
Dim iindex As Integer
'Attiva tutti gli elementi di ogni Check Box
Call ModP2k(Check1(iindex), 5)
Call ModP2k(Check2(iindex), 4)
Call ModP2k(Check3(iindex), 4)
Call ModP2k(Check4(iindex), 2)
Call ModP2k(Check5(iindex), 18)
Call ModP2k(Check6(iindex), 9)
'Disattiva le funzioni pericolose
If CheckAll.Value = 1 Then
Check1(0).Value = 1
Check5(1).Value = 1
Check5(2).Value = 1
Check5(7).Value = 1
Check5(10).Value = 1
Else
Check1(0).Value = 0
Check5(1).Value = 0
Check5(2).Value = 0
Check5(7).Value = 0
Check5(10).Value = 0
End If
Call Verifica
End Sub
Private Sub ModP2k(chk As CheckBox, MaxIndex As Integer)
If CheckAll.Value = 1 Then
For iindex = 0 To MaxIndex
chk(iindex).Value = 1
Next iindex
Else
For iindex = 0 To MaxIndex
chk(iindex).Value = 1
Next iindex
End If
End Sub
Private Sub CheckAll_Click()
Dim iindex As Integer
'Attiva tutti gli elementi di ogni Check Box
Call ModP2k(Check1(iindex), 5)
Call ModP2k(Check2(iindex), 4)
Call ModP2k(Check3(iindex), 4)
Call ModP2k(Check4(iindex), 2)
Call ModP2k(Check5(iindex), 18)
Call ModP2k(Check6(iindex), 9)
'Disattiva le funzioni pericolose
If CheckAll.Value = 1 Then
Check1(0).Value = 1
Check5(1).Value = 1
Check5(2).Value = 1
Check5(7).Value = 1
Check5(10).Value = 1
Else
Check1(0).Value = 0
Check5(1).Value = 0
Check5(2).Value = 0
Check5(7).Value = 0
Check5(10).Value = 0
End If
Call Verifica
End Sub