Index'li tane 9 tane combobox ekleyelim
Toplamlar için 6 adet label ekleyelim
Form'un gözükmeyen kısmına 1 adet listbox ekleyelim
Dim i, a, b As Integer
Private Sub Combo1_click(Index As Integer)
If Index = 0 Then
Label1 = Val(Combo1(0).Text) + Val(Combo1(1).Text) + Val(Combo1(2).Text)
For i = 0 To List1.ListCount - 1
If Combo1(0).Text = List1.List(i) Then
Combo1(i).Text = " "
List1.List(i) = " "
End If
Next i
List1.List(0) = Combo1(0).Text
ElseIf Index = 1 Then
Label1 = Val(Combo1(0).Text) + Val(Combo1(1).Text) + Val(Combo1(2).Text)
For i = 0 To List1.ListCount - 1
If Combo1(1).Text = List1.List(i) Then
Combo1(i).Text = " "
List1.List(i) = " "
End If
Next i
List1.List(1) = Combo1(1).Text
ElseIf Index = 2 Then
Label1 = Val(Combo1(0).Text) + Val(Combo1(1).Text) + Val(Combo1(2).Text)
For i = 0 To List1.ListCount - 1
If Combo1(2).Text = List1.List(i) Then
Combo1(i).Text = " "
List1.List(i) = " "
End If
Next i
List1.List(2) = Combo1(2).Text
End If
If Index = 3 Then
Label2 = Val(Combo1(3).Text) + Val(Combo1(4).Text) + Val(Combo1(5).Text)
For i = 0 To List1.ListCount - 1
If Combo1(3).Text = List1.List(i) Then
Combo1(i).Text = " "
List1.List(i) = " "
End If
Next i
List1.List(3) = Combo1(3).Text
ElseIf Index = 4 Then
Label2 = Val(Combo1(3).Text) + Val(Combo1(4).Text) + Val(Combo1(5).Text)
For i = 0 To List1.ListCount - 1
If Combo1(4).Text = List1.List(i) Then
Combo1(i).Text = " "
List1.List(i) = " "
End If
Next i
List1.List(4) = Combo1(4).Text
ElseIf Index = 5 Then
Label2 = Val(Combo1(3).Text) + Val(Combo1(4).Text) + Val(Combo1(5).Text)
For i = 0 To List1.ListCount - 1
If Combo1(5).Text = List1.List(i) Then
Combo1(i).Text = " "
List1.List(i) = " "
End If
Next i
List1.List(5) = Combo1(5).Text
End If
If Index = 6 Then
Label3 = Val(Combo1(6).Text) + Val(Combo1(7).Text) + Val(Combo1(8).Text)
For i = 0 To List1.ListCount - 1
If Combo1(6).Text = List1.List(i) Then
Combo1(i).Text = " "
List1.List(i) = " "
End If
Next i
List1.List(6) = Combo1(6).Text
ElseIf Index = 7 Then
Label3 = Val(Combo1(6).Text) + Val(Combo1(7).Text) + Val(Combo1(8).Text)
For i = 0 To List1.ListCount - 1
If Combo1(7).Text = List1.List(i) Then
Combo1(i).Text = " "
List1.List(i) = " "
End If
Next i
List1.List(7) = Combo1(7).Text
ElseIf Index = 8 Then
Label3 = Val(Combo1(6).Text) + Val(Combo1(7).Text) + Val(Combo1(8).Text)
For i = 0 To List1.ListCount - 1
If Combo1(8).Text = List1.List(i) Then
Combo1(i).Text = " "
List1.List(i) = " "
End If
Next i
List1.List(8) = Combo1(8).Text
End If
If Index = 0 Then
Label4 = Val(Combo1(0).Text) + Val(Combo1(3).Text) + Val(Combo1(6).Text)
ElseIf Index = 3 Then
Label4 = Val(Combo1(0).Text) + Val(Combo1(3).Text) + Val(Combo1(6).Text)
ElseIf Index = 6 Then
Label4 = Val(Combo1(0).Text) + Val(Combo1(3).Text) + Val(Combo1(6).Text)
End If
If Index = 1 Then
Label5 = Val(Combo1(1).Text) + Val(Combo1(4).Text) + Val(Combo1(7).Text)
ElseIf Index = 4 Then
Label5 = Val(Combo1(1).Text) + Val(Combo1(4).Text) + Val(Combo1(7).Text)
ElseIf Index = 7 Then
Label5 = Val(Combo1(1).Text) + Val(Combo1(4).Text) + Val(Combo1(7).Text)
End If
If Index = 2 Then
Label6 = Val(Combo1(2).Text) + Val(Combo1(5).Text) + Val(Combo1(8).Text)
ElseIf Index = 5 Then
Label6 = Val(Combo1(2).Text) + Val(Combo1(5).Text) + Val(Combo1(8).Text)
ElseIf Index = 8 Then
Label6 = Val(Combo1(2).Text) + Val(Combo1(5).Text) + Val(Combo1(8).Text)
End If
Label1 = Val(Combo1(0).Text) + Val(Combo1(1).Text) + Val(Combo1(2).Text)
Label2 = Val(Combo1(3).Text) + Val(Combo1(4).Text) + Val(Combo1(5).Text)
Label3 = Val(Combo1(6).Text) + Val(Combo1(7).Text) + Val(Combo1(8).Text)
Label4 = Val(Combo1(0).Text) + Val(Combo1(3).Text) + Val(Combo1(6).Text)
Label5 = Val(Combo1(1).Text) + Val(Combo1(4).Text) + Val(Combo1(7).Text)
Label6 = Val(Combo1(2).Text) + Val(Combo1(5).Text) + Val(Combo1(8).Text)
End Sub
Private Sub Form_Load()
For a = 0 To 8
For i = 1 To 9
Combo1(a).AddItem i
Next i
Next a
List1.AddItem " "
List1.AddItem " "
List1.AddItem " "
List1.AddItem " "
List1.AddItem " "
List1.AddItem " "
List1.AddItem " "
List1.AddItem " "
List1.AddItem " "
End Sub
Private Sub Label1_Change()
If Val(Label1) = 15 Then
Label1.BackColor = vbBlue
Label1.ForeColor = vbYellow
Else
Label1.BackColor = vbRed
Label1.ForeColor = vbYellow
End If
End Sub
Private Sub Label2_Change()
If Val(Label2) = 15 Then
Label2.BackColor = vbBlue
Label2.ForeColor = vbYellow
Else
Label2.BackColor = vbRed
Label2.ForeColor = vbYellow
End If
End Sub
Private Sub Label3_Change()
If Val(Label3) = 15 Then
Label3.BackColor = vbBlue
Label3.ForeColor = vbYellow
Else
Label3.BackColor = vbRed
Label3.ForeColor = vbYellow
End If
End Sub
Private Sub Label4_Change()
If Val(Label4) = 15 Then
Label4.BackColor = vbBlue
Label4.ForeColor = vbYellow
Else
Label4.BackColor = vbRed
Label4.ForeColor = vbYellow
End If
End Sub
Private Sub Label5_Change()
If Val(Label5) = 15 Then
Label5.BackColor = vbBlue
Label5.ForeColor = vbYellow
Else
Label5.BackColor = vbRed
Label5.ForeColor = vbYellow
End If
End Sub
Private Sub Label6_Change()
If Val(Label6) = 15 Then
Label6.BackColor = vbBlue
Label6.ForeColor = vbYellow
Else
Label6.BackColor = vbRed
Label6.ForeColor = vbYellow
End If
End Sub
Toplamlar için 6 adet label ekleyelim
Form'un gözükmeyen kısmına 1 adet listbox ekleyelim
Dim i, a, b As Integer
Private Sub Combo1_click(Index As Integer)
If Index = 0 Then
Label1 = Val(Combo1(0).Text) + Val(Combo1(1).Text) + Val(Combo1(2).Text)
For i = 0 To List1.ListCount - 1
If Combo1(0).Text = List1.List(i) Then
Combo1(i).Text = " "
List1.List(i) = " "
End If
Next i
List1.List(0) = Combo1(0).Text
ElseIf Index = 1 Then
Label1 = Val(Combo1(0).Text) + Val(Combo1(1).Text) + Val(Combo1(2).Text)
For i = 0 To List1.ListCount - 1
If Combo1(1).Text = List1.List(i) Then
Combo1(i).Text = " "
List1.List(i) = " "
End If
Next i
List1.List(1) = Combo1(1).Text
ElseIf Index = 2 Then
Label1 = Val(Combo1(0).Text) + Val(Combo1(1).Text) + Val(Combo1(2).Text)
For i = 0 To List1.ListCount - 1
If Combo1(2).Text = List1.List(i) Then
Combo1(i).Text = " "
List1.List(i) = " "
End If
Next i
List1.List(2) = Combo1(2).Text
End If
If Index = 3 Then
Label2 = Val(Combo1(3).Text) + Val(Combo1(4).Text) + Val(Combo1(5).Text)
For i = 0 To List1.ListCount - 1
If Combo1(3).Text = List1.List(i) Then
Combo1(i).Text = " "
List1.List(i) = " "
End If
Next i
List1.List(3) = Combo1(3).Text
ElseIf Index = 4 Then
Label2 = Val(Combo1(3).Text) + Val(Combo1(4).Text) + Val(Combo1(5).Text)
For i = 0 To List1.ListCount - 1
If Combo1(4).Text = List1.List(i) Then
Combo1(i).Text = " "
List1.List(i) = " "
End If
Next i
List1.List(4) = Combo1(4).Text
ElseIf Index = 5 Then
Label2 = Val(Combo1(3).Text) + Val(Combo1(4).Text) + Val(Combo1(5).Text)
For i = 0 To List1.ListCount - 1
If Combo1(5).Text = List1.List(i) Then
Combo1(i).Text = " "
List1.List(i) = " "
End If
Next i
List1.List(5) = Combo1(5).Text
End If
If Index = 6 Then
Label3 = Val(Combo1(6).Text) + Val(Combo1(7).Text) + Val(Combo1(8).Text)
For i = 0 To List1.ListCount - 1
If Combo1(6).Text = List1.List(i) Then
Combo1(i).Text = " "
List1.List(i) = " "
End If
Next i
List1.List(6) = Combo1(6).Text
ElseIf Index = 7 Then
Label3 = Val(Combo1(6).Text) + Val(Combo1(7).Text) + Val(Combo1(8).Text)
For i = 0 To List1.ListCount - 1
If Combo1(7).Text = List1.List(i) Then
Combo1(i).Text = " "
List1.List(i) = " "
End If
Next i
List1.List(7) = Combo1(7).Text
ElseIf Index = 8 Then
Label3 = Val(Combo1(6).Text) + Val(Combo1(7).Text) + Val(Combo1(8).Text)
For i = 0 To List1.ListCount - 1
If Combo1(8).Text = List1.List(i) Then
Combo1(i).Text = " "
List1.List(i) = " "
End If
Next i
List1.List(8) = Combo1(8).Text
End If
If Index = 0 Then
Label4 = Val(Combo1(0).Text) + Val(Combo1(3).Text) + Val(Combo1(6).Text)
ElseIf Index = 3 Then
Label4 = Val(Combo1(0).Text) + Val(Combo1(3).Text) + Val(Combo1(6).Text)
ElseIf Index = 6 Then
Label4 = Val(Combo1(0).Text) + Val(Combo1(3).Text) + Val(Combo1(6).Text)
End If
If Index = 1 Then
Label5 = Val(Combo1(1).Text) + Val(Combo1(4).Text) + Val(Combo1(7).Text)
ElseIf Index = 4 Then
Label5 = Val(Combo1(1).Text) + Val(Combo1(4).Text) + Val(Combo1(7).Text)
ElseIf Index = 7 Then
Label5 = Val(Combo1(1).Text) + Val(Combo1(4).Text) + Val(Combo1(7).Text)
End If
If Index = 2 Then
Label6 = Val(Combo1(2).Text) + Val(Combo1(5).Text) + Val(Combo1(8).Text)
ElseIf Index = 5 Then
Label6 = Val(Combo1(2).Text) + Val(Combo1(5).Text) + Val(Combo1(8).Text)
ElseIf Index = 8 Then
Label6 = Val(Combo1(2).Text) + Val(Combo1(5).Text) + Val(Combo1(8).Text)
End If
Label1 = Val(Combo1(0).Text) + Val(Combo1(1).Text) + Val(Combo1(2).Text)
Label2 = Val(Combo1(3).Text) + Val(Combo1(4).Text) + Val(Combo1(5).Text)
Label3 = Val(Combo1(6).Text) + Val(Combo1(7).Text) + Val(Combo1(8).Text)
Label4 = Val(Combo1(0).Text) + Val(Combo1(3).Text) + Val(Combo1(6).Text)
Label5 = Val(Combo1(1).Text) + Val(Combo1(4).Text) + Val(Combo1(7).Text)
Label6 = Val(Combo1(2).Text) + Val(Combo1(5).Text) + Val(Combo1(8).Text)
End Sub
Private Sub Form_Load()
For a = 0 To 8
For i = 1 To 9
Combo1(a).AddItem i
Next i
Next a
List1.AddItem " "
List1.AddItem " "
List1.AddItem " "
List1.AddItem " "
List1.AddItem " "
List1.AddItem " "
List1.AddItem " "
List1.AddItem " "
List1.AddItem " "
End Sub
Private Sub Label1_Change()
If Val(Label1) = 15 Then
Label1.BackColor = vbBlue
Label1.ForeColor = vbYellow
Else
Label1.BackColor = vbRed
Label1.ForeColor = vbYellow
End If
End Sub
Private Sub Label2_Change()
If Val(Label2) = 15 Then
Label2.BackColor = vbBlue
Label2.ForeColor = vbYellow
Else
Label2.BackColor = vbRed
Label2.ForeColor = vbYellow
End If
End Sub
Private Sub Label3_Change()
If Val(Label3) = 15 Then
Label3.BackColor = vbBlue
Label3.ForeColor = vbYellow
Else
Label3.BackColor = vbRed
Label3.ForeColor = vbYellow
End If
End Sub
Private Sub Label4_Change()
If Val(Label4) = 15 Then
Label4.BackColor = vbBlue
Label4.ForeColor = vbYellow
Else
Label4.BackColor = vbRed
Label4.ForeColor = vbYellow
End If
End Sub
Private Sub Label5_Change()
If Val(Label5) = 15 Then
Label5.BackColor = vbBlue
Label5.ForeColor = vbYellow
Else
Label5.BackColor = vbRed
Label5.ForeColor = vbYellow
End If
End Sub
Private Sub Label6_Change()
If Val(Label6) = 15 Then
Label6.BackColor = vbBlue
Label6.ForeColor = vbYellow
Else
Label6.BackColor = vbRed
Label6.ForeColor = vbYellow
End If
End Sub
Post A Comment:
0 comments: