How do I make a grid of circles?

I'm trying to make a grid of circles to fit the screen no matter the size, but whenever the button is pressed the companion crashes. There are no errors or anything within the code or companion, it just crashes. Please help

Most likely your two while tests are causing the problem. Replace then with if/else blocks

Both or just one? If one, which one.

Both

Could you show me? What ever I try either makes nothing or crashes the app

Something like this:

clear the canvas
for each y from 20 to Canvas1.Height by 20
  for each x from 20 to   Canvas1.Width by 20
     Draw circle at (x,y) 
  end for each
end for each