Imports System.Runtime.Serialization
Imports System.Reflection
Module SerCode
Public Sub LdSerial(ByVal Host As Object, ByVal info As SerializationInfo, ByVal context As StreamingContext)
Dim se As SerializationEntry
Dim sen As SerializationInfoEnumerator
If info.MemberCount > 0 Then
For Each se In info
Try
CallByName(Host, se.Name, CallType.Set, se.Value)
Catch
'no action
End Try
Next
End If
End Sub
Public Sub SetSerial(ByVal Host As Object, ByVal info As System.Runtime.Serialization.SerializationInfo, ByVal context As System.Runtime.Serialization.StreamingContext)
Dim t As Type
Dim mi As PropertyInfo
Dim ov As Object
t = Host.GetType
Dim pi As PropertyInfo() = t.GetProperties((BindingFlags.Instance Or BindingFlags.Public))
For Each mi In pi
Try
Select Case mi.Name
Case "Parent"
'do not serialize
Case Else
If mi.CanWrite Or mi.PropertyType.BaseType Is GetType(nbfBrowseCol) Then
Try
ov = CallByName(Host, mi.Name, CallType.Get)
If Not ov Is Nothing Then
info.AddValue(mi.Name, ov, ov.GetType)
End If
Catch
'no action
End Try
End If
End Select
Catch
'no action
End Try
Next mi
End Sub
Friend Function GetRepFontInfo(ByVal rfi As RepFontInfo, ByVal fi As FontInfo) As RepFontInfo
With rfi
.Bold = fi.Bold
.Colour = fi.Colour
.DoubleUnderlined = fi.DoubleUnderlined
.FontName = fi.FontName
.FontSize = fi.FontSize
.Italic = fi.Italic
.StrikeOut = fi.StrikeOut
.Underlined = fi.Underlined
End With
End Function
Friend Function GetOutFontInfo(ByVal fi As RepFontInfo) As FontInfo
Dim rfi As New FontInfo
With rfi
.Bold = fi.Bold
.Colour = fi.Colour
.DoubleUnderlined = fi.DoubleUnderlined
.FontName = fi.FontName
.FontSize = fi.FontSize
.Italic = fi.Italic
.StrikeOut = fi.StrikeOut
.Underlined = fi.Underlined
End With
Return rfi
End Function
Function rep_string(ByVal bstr As String, ByVal dchr As String, ByVal rchr As String, Optional ByRef txtcomp As Boolean = False) As String
Dim cp As Short
Dim Start As Object
Dim spos As Short
Dim retv As String ' Declare variables.
If txtcomp Then
cp = 1
Else
cp = 0
End If
Start = InStr(1, bstr, dchr, cp) ' Find where "fox" begins.
While Not Start = 0 'InStr(spos%, rs, "'") = 0
bstr = Mid(bstr, 1, Start - 1) & rchr & Mid(bstr, Start + Len(dchr), Len(bstr))
spos = Start + Len(rchr)
Start = InStr(spos, bstr, dchr, cp)
End While
rep_string = bstr
End Function
End Module