dim sum as integer = 0 dim i as integer = 0 while sum < 1000 i += 1 sum += cint(math.pow(i, 2)) end while messagebox.show((i - 1).tostring())