I'm debugging a VB program that is written by the guy who already left the company. I found out the main problem is that the guy used object assignment which will mess up the data. For example, I have a customized class as following:
Expand|Select|Wrap|Line Numbers
- Public Class testCell
- Private _name As String = ""
- Private isCopied As Boolean = False
- Public Property Name() As String
- Get
- Return _name
- End Get
- Set(ByVal Value As String)
- _name = Value
- End Set
- End Property
- Public Property isCopy() As Boolean
- Get
- Return isCopied
- End Get
- Set(ByVal Value As Boolean)
- isCopied = Value
- End Set
- End Property
- Public Sub Reset()
- _name = ""
- isCopied = False
- End Sub
- End Class
Expand|Select|Wrap|Line Numbers
- Dim cell1 As testCell = New testCell
- Dim cell2 As testCell = New testCell
- cell1 = cell2
- cell2.Name = "Ben"
- If cell1.Name = "Ben" Then
- MsgBox("Object is referenced")
- End If
Now I know I can use:
Expand|Select|Wrap|Line Numbers
- cell1.Name = cell2.Name
- cell1.isCopy = cell2.isCopy
Ben