1
Reply

Label visibility issues

Steve

Steve

Jan 15 2009 12:37 AM
7.8k
I'm writing a Sudoku program, using 9 small labels for notes and 1 larger label for the actual marks per square. The notes and marks work fine, but what I'm trying to do is when the user clicks a "show solution" menu item, it copies all of the already entered numbers from the mark boxes into the top right note box, then displays the full solution in the mark boxes AND the user-entered numbers in the top right corner of each box (so the user can see which numbers they got right or wrong...). However I can't seem to get the note box to show on top of the mark box...

Here is my code to create the note and mark boxes...

For i = 0 To 8
For j = 0 To 8
MarkBoxes(i, j) = New MarkBox()
MarkBoxes(i, j).Setup(i, j)
Controls.Add(MarkBoxes(i, j))
For k = 0 To 8
NoteBoxes(i, j, k) = New NoteBox()
NoteBoxes(i, j, k).Setup(i, j, k)
Controls.Add(NoteBoxes(i, j, k))
Next k
Next j
Next i

And the code to show the solution:

For i = 0 To 8
For j = 0 To 8
Dim Place As Integer = i * 9 + j
Dim Number As String = Numbers.Substring(Place, 1)
For k As Integer = 0 To 8
If k <> 2 Then
NoteBoxes(i, j, k).Visible = False
Else
NoteBoxes(i, j, k).Text = MarkBoxes(i, j).Text
NoteBoxes(i, j, k).Visible = True
End If
Next k
MarkBoxes(i, j).ForeColor = System.Drawing.Color.Black
MarkBoxes(i, j).Text = Number
MarkBoxes(i, j).SetLocked()
MarkBoxes(i, j).Visible = True
Next j
Next i

It shows the entire solution just fine, but doesn't show the note box with the user-entered numbers... Is there some kind of priority or move-to-top thing I'm missing? Or a problem with my code? I've been stuck for days trying all kinds of different things. Please help!

Answers (1)