VERSION 5.00 Begin VB.Form SuDoKu_Main BackColor = &H80000018& Caption = "Form2" ClientHeight = 8730 ClientLeft = 60 ClientTop = 345 ClientWidth = 9750 LinkTopic = "Form2" ScaleHeight = 582 ScaleMode = 3 'Pixel ScaleWidth = 650 StartUpPosition = 3 'Windows Default Begin VB.CommandButton cmdUnFix Caption = "Un-Fix" Height = 375 Left = 8820 TabIndex = 11 Top = 1020 Width = 915 End Begin VB.CommandButton cmdFix Caption = "Fix" Height = 375 Left = 8820 TabIndex = 10 Top = 540 Width = 915 End Begin VB.CommandButton cmdReset Caption = "Reset" Height = 375 Left = 8820 TabIndex = 9 Top = 60 Width = 915 End Begin SuDoKu.usrcntSquare usrcntGrid Height = 2835 Index = 0 Left = 0 TabIndex = 0 Top = 0 Width = 2835 _ExtentX = 5001 _ExtentY = 5001 End Begin SuDoKu.usrcntSquare usrcntGrid Height = 2835 Index = 1 Left = 2940 TabIndex = 1 Top = 0 Width = 2835 _ExtentX = 5001 _ExtentY = 5001 End Begin SuDoKu.usrcntSquare usrcntGrid Height = 2835 Index = 2 Left = 5880 TabIndex = 2 Top = 0 Width = 2835 _ExtentX = 5001 _ExtentY = 5001 End Begin SuDoKu.usrcntSquare usrcntGrid Height = 2835 Index = 3 Left = 0 TabIndex = 3 Top = 2940 Width = 2835 _ExtentX = 5001 _ExtentY = 5001 End Begin SuDoKu.usrcntSquare usrcntGrid Height = 2835 Index = 4 Left = 2940 TabIndex = 4 Top = 2940 Width = 2835 _ExtentX = 5001 _ExtentY = 5001 End Begin SuDoKu.usrcntSquare usrcntGrid Height = 2835 Index = 5 Left = 5880 TabIndex = 5 Top = 2940 Width = 2835 _ExtentX = 5001 _ExtentY = 5001 End Begin SuDoKu.usrcntSquare usrcntGrid Height = 2835 Index = 6 Left = 0 TabIndex = 6 Top = 5880 Width = 2835 _ExtentX = 5001 _ExtentY = 5001 End Begin SuDoKu.usrcntSquare usrcntGrid Height = 2835 Index = 7 Left = 2940 TabIndex = 7 Top = 5880 Width = 2835 _ExtentX = 5001 _ExtentY = 5001 End Begin SuDoKu.usrcntSquare usrcntGrid Height = 2835 Index = 8 Left = 5880 TabIndex = 8 Top = 5880 Width = 2835 _ExtentX = 5001 _ExtentY = 5001 End End Attribute VB_Name = "SuDoKu_Main" Attribute VB_GlobalNameSpace = False Attribute VB_Creatable = False Attribute VB_PredeclaredId = True Attribute VB_Exposed = False Option Explicit '---------------------------------------------------------- ' Written 12/2006 by Keith Oxenrider ' Use at your own risk! ' No warrenty expressed or implied! '---------------------------------------------------------- Private Sub cmdFix_Click() Dim i As Integer For i = 0 To 8 usrcntGrid(i).fixIt True Next i End Sub Private Sub cmdUnFix_Click() Dim i As Integer For i = 0 To 8 usrcntGrid(i).fixIt False Next i End Sub Private Sub cmdReset_Click() Dim i As Integer For i = 0 To 8 usrcntGrid(i).Clear Next i End Sub Private Sub usrcntGrid_Click(index As Integer, ByVal squareIndex As Integer, ByVal btnIndex As Integer, ByVal setIt As Boolean) Dim row As Integer Dim col As Integer If squareIndex = 0 Or squareIndex = 1 Or squareIndex = 2 Then row = 0 If squareIndex = 3 Or squareIndex = 4 Or squareIndex = 5 Then row = 1 If squareIndex = 6 Or squareIndex = 7 Or squareIndex = 8 Then row = 2 If squareIndex = 0 Or squareIndex = 3 Or squareIndex = 6 Then col = 0 If squareIndex = 1 Or squareIndex = 4 Or squareIndex = 7 Then col = 1 If squareIndex = 2 Or squareIndex = 5 Or squareIndex = 8 Then col = 2 ' 0 1 2 ' 3 4 5 ' 6 7 8 If index = 0 Then usrcntGrid(1).SetRow row, btnIndex, setIt usrcntGrid(2).SetRow row, btnIndex, setIt usrcntGrid(3).SetCol col, btnIndex, setIt usrcntGrid(6).SetCol col, btnIndex, setIt End If If index = 1 Then usrcntGrid(0).SetRow row, btnIndex, setIt usrcntGrid(2).SetRow row, btnIndex, setIt usrcntGrid(4).SetCol col, btnIndex, setIt usrcntGrid(7).SetCol col, btnIndex, setIt End If If index = 2 Then usrcntGrid(0).SetRow row, btnIndex, setIt usrcntGrid(1).SetRow row, btnIndex, setIt usrcntGrid(5).SetCol col, btnIndex, setIt usrcntGrid(8).SetCol col, btnIndex, setIt End If If index = 3 Then usrcntGrid(4).SetRow row, btnIndex, setIt usrcntGrid(5).SetRow row, btnIndex, setIt usrcntGrid(0).SetCol col, btnIndex, setIt usrcntGrid(6).SetCol col, btnIndex, setIt End If If index = 4 Then usrcntGrid(3).SetRow row, btnIndex, setIt usrcntGrid(5).SetRow row, btnIndex, setIt usrcntGrid(1).SetCol col, btnIndex, setIt usrcntGrid(7).SetCol col, btnIndex, setIt End If If index = 5 Then usrcntGrid(3).SetRow row, btnIndex, setIt usrcntGrid(4).SetRow row, btnIndex, setIt usrcntGrid(2).SetCol col, btnIndex, setIt usrcntGrid(8).SetCol col, btnIndex, setIt End If If index = 6 Then usrcntGrid(7).SetRow row, btnIndex, setIt usrcntGrid(8).SetRow row, btnIndex, setIt usrcntGrid(0).SetCol col, btnIndex, setIt usrcntGrid(3).SetCol col, btnIndex, setIt End If If index = 7 Then usrcntGrid(6).SetRow row, btnIndex, setIt usrcntGrid(8).SetRow row, btnIndex, setIt usrcntGrid(1).SetCol col, btnIndex, setIt usrcntGrid(4).SetCol col, btnIndex, setIt End If If index = 8 Then usrcntGrid(6).SetRow row, btnIndex, setIt usrcntGrid(7).SetRow row, btnIndex, setIt usrcntGrid(2).SetCol col, btnIndex, setIt usrcntGrid(5).SetCol col, btnIndex, setIt End If End Sub ' 0 = 1, 2 : 3, 6 ' 1 = 0, 2 : 4, 7 ' 2 = 0, 1 : 5, 8 ' 3 = 4, 5 : 0, 6 ' 4 = 3, 5 : 1, 7 ' 5 = 3, 4 : 2, 8 ' 6 = 7, 8 : 0, 3 ' 7 = 6, 8 : 1, 4 ' 8 = 6, 7 : 2, 5 ' 0 1 2 ' 3 4 5 ' 6 7 8