Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > System.StackOverflowException

Reply
Thread Tools

System.StackOverflowException

 
 
Simon Harris
Guest
Posts: n/a
 
      05-08-2005
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


 
Reply With Quote
 
 
 
 
Simon Harris
Guest
Posts: n/a
 
      05-08-2005
Never mind - Realised my properties were in a right old mess


"Simon Harris" <too-much-> wrote in message
news:...
> 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!


 
Reply With Quote
 
 
 
 
Sherif
Guest
Posts: n/a
 
      05-08-2005
Hello
Change
Title = pStrTitle
to
pStrTitle = Value

Best regards,
Sherif

"Simon Harris" <too-much-> wrote in message
news:...
> 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
>



 
Reply With Quote
 
Alvin Bruney [MVP - ASP.NET]
Guest
Posts: n/a
 
      05-09-2005
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-> wrote in message
news:...
> 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
>



 
Reply With Quote
 
Web Team @ Borough of Poole
Guest
Posts: n/a
 
      05-11-2005
....but thanks for the replies (I posted my reply before yours appeared)

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off




Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57