You don;t say what happens when it crashes, but I'd guess that the likely cause is that
intInitialInvestment
never equals the value of
intValue
, so your loop never exits.
Start by looking at what happens in the debugger: put a breakpoint on the line
Dim i As Integer = 1
and run your program.
When you hit the breakpoint, the program will stop and let you control what is happening.
Step through, and look closely at what happens to
intInitialInvestment
each time.