I have a datagridview that the user can change to various rows and columns (its a grid of squares)
When the user presses a button, it generates a list of coordinates of all the squares that are black.
That is obviously generated in order.
I want it to be mixed up, so that the coordinates arent in order: (2,1) (1,3) (2,2) not (1,3) (2,1) (2,2)
Here is the code that I have so far:
Public Sub GenerateCoordinates()
temporary = 0
For index As Integer = 0 To Grid.RowCount - 1
For index2 As Integer = 0 To Grid.ColumnCount - 1
If (Grid.Rows(index).Cells(index2).Style.BackColor = Color.Black) Then
temporary += 1
If (Len("(" & index2 + 1 & "," & index + 1 & ")") > 5) Then
If (Len("(" & index2 + 1 & "," & index + 1 & ")") = 6) Then
builder.Append("(" & index2 + 1 & "," & index + 1 & ") ")
End If
If (Len("(" & index2 + 1 & "," & index + 1 & ")") = 7) Then
builder.Append("(" & index2 + 1 & "," & index + 1 & ") ")
End If
Else
builder.Append("(" & index2 + 1 & "," & index + 1 & ") ")
End If
End If
If (temporary = PrinterDialog.CoordinateRows.Value) Then
temporary = 0
builder.Append(vbCrLf)
End If
Next
Next
Form2.CoordinateList.Text = builder.ToString()
End Sub
All of those nested IFs are a replacement for tabs.