I remember being pointed somewhere before about getting help for VB.NET but
at this moment I can't find it (look at the timestamp, there might be a
reason for that).

I'm working with a custom class in a disk-based app that creates a text
file.  One requirement is that if a certain set of parameters is met (name
and value match), I have to, "copy that line, adjust these values and save
both lines to the file."

For brevity's sake I'll annotate my example:
Public class a
  Public name as string
  Public Value1 as Decimal
  Public Value2 as Decimal

...
End Class

Dim test as New a()

...

if test.Name = "CopyMe"
   Dim copy as a = test.clone()

  copy.Name = "Copied"
  copy.value1 -= 10
  copy.value2 += 5

  test.value2 -= 5

  writeln(copy)
End if

writeln(test)


Okay, the pseudocode's atrocious but again, look at the hour and forgive me
please.

I have tried "shallow" clones as well as "deep" clones (which borked
because of serialization).  In EVERY case I'm getting the original values
that were in the test object before it was cloned.  It's as if VB is
saying, "yeah, I see your code and I'll run it but nothing's going to
change your values.  I've tried declaring GET and SET properties in the
class.  The only thing I haven't done (because I didn't think it would be
necessary) is to either come up with a way to create the copy "fresh"...
which I don't think would work because the values in the test object aren't
being adjusted... or somehow move the logic back into the class.

Anyone have an idea as to why VB is creating the copy and then saying,
"screw you, I'm not changing any values!"

Until Later!
C. Hatton Humphrey
http://www.eastcoastconservative.com

Every cloud does have a silver lining.  Sometimes you just have to do some
smelting to find it.


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-community/message.cfm/messageid:371364
Subscription: http://www.houseoffusion.com/groups/cf-community/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-community/unsubscribe.cfm

Reply via email to