For r = 0 To ROWS - 1 For c = 0 To COLS - 1 Dim val = nums(r, c) Console.WriteLine(val) If val = 20 Then r = ROWS Exit For End If Next Next