System.StackOverflowException

  • Thread starter Thread starter Simon Harris
  • Start date Start date
S

Simon Harris

Hi All,

When I set the property of title in my class (Shown below) I get a
"Exception of type System.StackOverflowException was thrown." error message.

I'm guessing I got some sort of horrible loop going on, where did I go
wrong?

Thanks,
Simon.

Private pTitleAs String

Public Property Title() As String
Get
Return pStrTitle
End Get
Set(ByVal Value As String)
Title = pStrTitle
End Set
End Property
 
you're setting the title of the string with pstrTitle, but the set action
itself calls the property again recursively. The solution provided by sherif
will fix the problem, i just thought you wanted to know the why.

--
Regards,
Alvin Bruney - ASP.NET MVP

[Shameless Author Plug]
The Microsoft Office Web Components Black Book with .NET
Now available @ www.lulu.com/owc, Amazon.com etc
 
....but thanks for the replies (I posted my reply before yours appeared)
 
Back
Top