My program can solve a sudoku with any no. of problem no.s from 0 to 80.

If you run this program, you get a 9*9 grid.In that you go to places using navigation keys.And you enter the numbers.
Go to following locations and try entering following input:
row col no.
0 0 1
0 1 2
0 2 3
1 0 4
1 1 5
1 2 6
2 3 8
And hit enter that is you want to solve this problem.The program goes in infinite loop.This is because in first 3*3 square 8 is possible nowhere.

My validity check checks if a number user trying to enter is unique in corrosponding row and column and 3*3 square.

So the above input passes validity check.But as can be seen it's not a valid problem.

I want some help with validity check, which can detect errors such as in above given input.