Evaluate a reassigned variable

  • Thread starter Thread starter Michel Racicot
  • Start date Start date
M

Michel Racicot

How can I put a watch on the "Foo" control in the following exemple:

MyInput = CreateMyControl ("Foo")
MyInput.ReadOnly = True
TD = New HtmlTableCell
TD.Controls.Add(Input)
TD.Cells.Add(TD)
MyInput = CreateMyControl ("Bar")
MyInput.ReadOnly = True
TD = New HtmlTableCell
TD.Controls.Add(Input)
TD.Cells.Add(TD)

Since MyInput is reassigned, I can't use it to watch the Foo control later
on...

Is there a way to watch the resolution of MyInput Address?
?
 
Michel said:
How can I put a watch on the "Foo" control in the following exemple:
MyInput = CreateMyControl ("Foo")
. . .
MyInput = CreateMyControl ("Bar")
. . .
Since MyInput is reassigned, I can't use it to watch the Foo control later
on...

Use another variable to hold Foo.
There's no huge memory overhead in having multiple Object reference
variables - you're only storing a reference, not a complete copy of the
object/control.

Dim myFoo as Control = CreateMyControl("Foo")

MyFoo.ReadOnly = True
TD = New HtmlTableCell
TD.Controls.Add(MyFoo)
TD.Cells.Add(TD)

MyInput = CreateMyControl("Bar")
MyInput.ReadOnly = True
TD = New HtmlTableCell
TD.Controls.Add(MyInput)
TD.Cells.Add(TD)

HTH,
Phill W.
 
Back
Top