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 PropertyHello
Change
Title = pStrTitle
to
pStrTitle = Value
Best regards,
Sherif
"Simon Harris" <too-much-spam@.makes-you-fat.com> wrote in message
news:u1VhjPBVFHA.3432@.TK2MSFTNGP10.phx.gbl...
> 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
"Simon Harris" <too-much-spam@.makes-you-fat.com> wrote in message
news:u1VhjPBVFHA.3432@.TK2MSFTNGP10.phx.gbl...
> 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
Never mind - Realised my properties were in a right old mess :)
"Simon Harris" <too-much-spam@.makes-you-fat.com> wrote in message
news:u1VhjPBVFHA.3432@.TK2MSFTNGP10.phx.gbl...
> 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
--
I am using the free version of SPAMfighter for private users.
It has removed 2175 spam emails to date.
Paying users do not have this message in their emails.
Try www.SPAMfighter.com for free now!
...but thanks for the replies (I posted my reply before yours appeared)
0 comments:
Post a Comment