Farooq Alsaegh Farooq Alsaegh - 2 months ago 12
Vb.net Question

asp.net vb.net can any one explain what is wrong?

What is wrong with this code?

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Dim i As Integer = 0
Do
Response.Write("hello")
Loop While i < 5
End Sub


I have Error

System.OutOfMemoryException was unhandled
Insufficient memory to continue the execution of the program.


Can anyone explain why I have that error?

Answer

This is the fixed version of your code:

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
    Dim i As Integer = 0
    Do
        Response.Write("hello")
        i = i + 1
    Loop While i < 5
End Sub