IsInitializing Property (boolean) hangs on property set

G

Grumpy Aero Guy

I am upgrading an app from 6.0 to VB.

Have a couple of radio buttons that gave me the "may fire when form is
initialized" upgrade message. (no problem)

Added an Isinitializing property (boolean):

----------------------------------------------------------------------------
---------
Private Property IsInitializing() As String

Get

Return IsInitializing

End Get

Set(ByVal Value As String)

IsInitializing = Value

End Set

End Property



----------------------------------------------------------------------------
-------------------------

When I try to set this property as such:

----------------------------------------------------------------------------
----
Me.IsInitializing() = "True"

InitializeComponent()

Me.IsInitializing = "False"

----------------------------------------------------------------------------
----------------------------------------------

in the "new" method of my form class, I get an error, as the property gets
hung when it tries to set the "isinitialized" property to true:

"An unhandled exception of type 'System.StackOverflowException' occurred "

The hanging app is the property get routine....I debugged and tracked it
into the property set routine where it blows up for no apparent reason.

Any wisdom out there???
--



Frank Bachman
(Grumpy Aero Guy)
 
C

Cor Ligthert

Hi Grumpy

I do not see it in this code however mostly this is the normal answer on an
infinite loop

Cor

"
 
A

Armin Zingler

Grumpy Aero Guy said:
I am upgrading an app from 6.0 to VB.

Have a couple of radio buttons that gave me the "may fire when form
is initialized" upgrade message. (no problem)

Added an Isinitializing property (boolean):

-------------------------------------------------------------------------- --
---------
Private Property IsInitializing() As String

Get

Return IsInitializing

Here you recursively call the Get method again.
End Get

Set(ByVal Value As String)

IsInitializing = Value

Here you recursively call the Set method again.
End Set

End Property

You need a field to store the value, otherwise you'll get a stack overflow.


--
Armin

How to quote and why:
http://www.plig.net/nnq/nquote.html
http://www.netmeister.org/news/learn2quote.html
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top