LSET Equivalent

  • Thread starter Thread starter Terry Holland
  • Start date Start date
T

Terry Holland

I have a code builder that I use for writing my VB6 classes. I ran the Code
Advisor on the generated code & found that LSet is not supported in VB.Net
I use this in a number of places in my methods to store the state of my
class properties in a copy of a udt

Here is an example of how I use it in my CancelEdit function.

=================================
Public Sub CancelEdit()
If m_booIsChild Then If Not m_booIsChildEditing Then Err.Raise 445
If Not m_booIsEditing Then Err.Raise 445

m_booIsEditing = False
m_booIsDeleted = False
m_booIsDirty = False

'Restore object state
LSet m_udtProps = m_udtSave
RaiseEvent NowClean
End Sub
=================================


m_udtProps is a udt that contains all my class properties
m_ustSave is a copy of this (got by using LSet m_udtSave = m_udtProps).
If I cancel my edit before saving, I can use the LSet function to reset my
m_udtProps to its original state before any edits were carried out.

Any ideas on how to easily convert this sort of code would be appreciated.

tia

Terry Holland
 
* "Terry Holland said:
I have a code builder that I use for writing my VB6 classes. I ran the Code
Advisor on the generated code & found that LSet is not supported in VB.Net
I use this in a number of places in my methods to store the state of my
class properties in a copy of a udt

Here is an example of how I use it in my CancelEdit function.

=================================
Public Sub CancelEdit()
If m_booIsChild Then If Not m_booIsChildEditing Then Err.Raise 445
If Not m_booIsEditing Then Err.Raise 445

m_booIsEditing = False
m_booIsDeleted = False
m_booIsDirty = False

'Restore object state
LSet m_udtProps = m_udtSave
RaiseEvent NowClean
End Sub
=================================


m_udtProps is a udt that contains all my class properties
m_ustSave is a copy of this (got by using LSet m_udtSave = m_udtProps).
If I cancel my edit before saving, I can use the LSet function to reset my
m_udtProps to its original state before any edits were carried out.

For classes, have a look at the interface 'ICloneable'.
 
Back
Top