Click here to Skip to main content
15,885,546 members
Articles / Programming Languages / Visual Basic

Open Door - Reporting, Charts, Enquiry Drill-Downs

Rate me:
Please Sign up or sign in to vote.
4.37/5 (11 votes)
2 Feb 2009CPOL6 min read 39.2K   2K   59  
A utility for generating user editable reports, charts, documents, enquiries
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

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
United Kingdom United Kingdom
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions