Public MustInherit Class TransactionForm Inherits System.Windows.Forms.Form Public Overridable Function Read(ByVal FileName As String) As Boolean 'declare a file and serialize class Dim TranFile As Stream Dim BinSerialize As BinaryFormatter 'Set the return value to True Read = True 'Use Try/Catch to handle any errors Try 'Allocate and open the file and de-serialize objects TranFile = File.Open(FileName, FileMode.Open) BinSerialize = New BinaryFormatter() 'Serialize the MsgText() property which is a String object AmountField.Text = CType(BinSerialize.Deserialize(TranFile), String) MemoField.Text = CType(BinSerialize.Deserialize(TranFile), String) DateField.Text = CType(BinSerialize.Deserialize(TranFile), String) 'Call ReadData() to read derived class's data ReadData(BinSerialize, TranFile) Catch 'Indicate an error occurred Read = False End Try TranFile.Close() End Function 'Declare Abstract method to read derived class's data Protected MustOverride Sub ReadData(ByRef BinSerialize As BinaryFormatter,_ ByRef TranFile As Stream) ... End Class Public Class DepositForm Inherits TransactionForm Implements IPrint Protected Overrides Sub ReadData(ByRef BinSerialize As BinaryFormatter,_ ByRef TranFile As Stream) DepositToField.Text = CType(BinSerialize.Deserialize(TranFile), String) End Sub ... End Class Public Class WithdrawForm Inherits TransactionForm Implements IPrint Protected Overrides Sub ReadData(ByRef BinSerialize As BinaryFormatter, _ ByRef TranFile As Stream) PayToField.Text = CType(BinSerialize.Deserialize(TranFile), String) End Sub ... End Class