Click here to Skip to main content
15,896,063 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.4K   2K   59  
A utility for generating user editable reports, charts, documents, enquiries
imports nbfSqlReporter
Public Class nbfDelSection
    Inherits System.Windows.Forms.Form
    Public Abandoned as Boolean
    Public CTRemove as boolean = false
    Public pvSI as nbfStyleInfo.AppStyle
    Public sqs As nbfSqlSource
    Private RSS as nbfSqlReporter.nbfSQLRepSections
#Region " Windows Form Designer generated code "

    Public Sub New()
        MyBase.New()

        'This call is required by the Windows Form Designer.
        InitializeComponent()

        'Add any initialization after the InitializeComponent() call

    End Sub

    'Form overrides dispose to clean up the component list.
    Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
        If disposing Then
            If Not (components Is Nothing) Then
                components.Dispose()
            End If
        End If
        MyBase.Dispose(disposing)
    End Sub

    'Required by the Windows Form Designer
    Private components As System.ComponentModel.IContainer

    'NOTE: The following procedure is required by the Windows Form Designer
    'It can be modified using the Windows Form Designer.  
    'Do not modify it using the code editor.
    Friend WithEvents Button1 As System.Windows.Forms.Button
    Friend WithEvents Button2 As System.Windows.Forms.Button
    Friend WithEvents btnControls As System.Windows.Forms.Button
    Friend WithEvents NbfGrid1 As odGridControls.nbfGrid
    Friend WithEvents HelpProvider1 As System.Windows.Forms.HelpProvider
    Friend WithEvents btnBreaks As System.Windows.Forms.Button
    <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
        Dim resources As System.Resources.ResourceManager = New System.Resources.ResourceManager(GetType(nbfDelSection))
        Me.Button1 = New System.Windows.Forms.Button
        Me.Button2 = New System.Windows.Forms.Button
        Me.btnControls = New System.Windows.Forms.Button
        Me.NbfGrid1 = New odGridControls.nbfGrid
        Me.HelpProvider1 = New System.Windows.Forms.HelpProvider
        Me.btnBreaks = New System.Windows.Forms.Button
        Me.SuspendLayout()
        '
        'Button1
        '
        Me.Button1.Anchor = CType((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
        Me.Button1.Location = New System.Drawing.Point(400, 12)
        Me.Button1.Name = "Button1"
        Me.Button1.Size = New System.Drawing.Size(56, 20)
        Me.Button1.TabIndex = 1
        Me.Button1.Text = "OK"
        '
        'Button2
        '
        Me.Button2.Anchor = CType((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
        Me.Button2.Location = New System.Drawing.Point(400, 40)
        Me.Button2.Name = "Button2"
        Me.Button2.Size = New System.Drawing.Size(56, 20)
        Me.Button2.TabIndex = 2
        Me.Button2.Text = "Cancel"
        '
        'btnControls
        '
        Me.btnControls.Anchor = CType((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
        Me.btnControls.Location = New System.Drawing.Point(400, 68)
        Me.btnControls.Name = "btnControls"
        Me.btnControls.Size = New System.Drawing.Size(56, 20)
        Me.btnControls.TabIndex = 3
        Me.btnControls.Text = "Controls"
        Me.btnControls.Visible = False
        '
        'NbfGrid1
        '
        Me.NbfGrid1.AllowEdit = False
        Me.NbfGrid1.Anchor = CType((((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Bottom) _
                    Or System.Windows.Forms.AnchorStyles.Left) _
                    Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
        Me.NbfGrid1.HDBC = Nothing
        Me.NbfGrid1.Location = New System.Drawing.Point(4, 4)
        Me.NbfGrid1.Name = "NbfGrid1"
        Me.NbfGrid1.RepBreak1HeadFont = New System.Drawing.Font("Tahoma", 8.0!, System.Drawing.FontStyle.Bold)
        Me.NbfGrid1.RepBreak2HeadFont = New System.Drawing.Font("Tahoma", 8.0!)
        Me.NbfGrid1.RepSubHeadFont = New System.Drawing.Font("Tahoma", 8.0!, System.Drawing.FontStyle.Bold)
        Me.NbfGrid1.Size = New System.Drawing.Size(388, 268)
        Me.NbfGrid1.SourceGList = Nothing
        Me.NbfGrid1.SourceObject = Nothing
        Me.NbfGrid1.SourceObjectType = Nothing
        Me.NbfGrid1.SourceSQL = Nothing
        Me.NbfGrid1.SourceTable = Nothing
        Me.NbfGrid1.TabIndex = 4
        Me.NbfGrid1.Text = "NbfGrid1"
        '
        'btnBreaks
        '
        Me.btnBreaks.Anchor = CType((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
        Me.btnBreaks.Location = New System.Drawing.Point(400, 96)
        Me.btnBreaks.Name = "btnBreaks"
        Me.btnBreaks.Size = New System.Drawing.Size(56, 20)
        Me.btnBreaks.TabIndex = 5
        Me.btnBreaks.Text = "Breaks"
        Me.btnBreaks.Visible = False
        '
        'nbfDelSection
        '
        Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
        Me.ClientSize = New System.Drawing.Size(460, 273)
        Me.Controls.Add(Me.btnBreaks)
        Me.Controls.Add(Me.NbfGrid1)
        Me.Controls.Add(Me.btnControls)
        Me.Controls.Add(Me.Button2)
        Me.Controls.Add(Me.Button1)
        Me.Icon = CType(resources.GetObject("$this.Icon"), System.Drawing.Icon)
        Me.Name = "nbfDelSection"
        Me.Text = "Select Section"
        Me.ResumeLayout(False)

    End Sub

#End Region
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        If nbfGrid1.AllowEdit Then
            nbfGrid1.Update()
        End If
        abandoned = False
        Me.Hide()
    End Sub
    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        CTRemove = True
        abandoned = True
        Me.Hide()
    End Sub
    Protected Overrides Sub OnLoad(ByVal e As System.EventArgs)
        Me.helpProvider1.HelpNamespace = "OpenDoor.chm"
        Me.helpProvider1.SetShowHelp(Me, True)
    End Sub
    Public Sub SetUpData(ByVal SI As nbfStyleInfo.AppStyle, ByVal InRs As nbfSqlReporter.nbfSQLRepSections)
        pvSI = Si
        RSS = InRs
    End Sub
    Private Sub btnControls_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnControls.Click

        Dim rs As nbfSQLRepSection
        rs = RSS.Item(NbfGrid1.SelectedIndex)

        Dim ss As New nbfDelSection
        nbfBrowseHost.SetStyles(ss, pvSI)

        ss.nbfGrid1.GridCaptionVisible = False
        ss.nbfGrid1.ColHeadersVisible = True
        ss.nbfGrid1.RowHeadersVisible = False
        ss.nbfGrid1.AllowEdit = False
        ss.nbfGrid1.AllowAdd = False

        Dim ncd As odGridControls.nbfGridColumn
        ncd = New odGridControls.nbfGridColumn
        ncd.PropertyName = "Name"
        ncd.ColHeader = "Name"
        ncd.Width = 60
        ncd.DataType = odGridControls.nbfColumnDataType.nbfDataTypeString
        ss.nbfGrid1.Columns.Add(ncd)

        ncd = New odGridControls.nbfGridColumn
        ncd.PropertyName = "CtlType"
        ncd.ColHeader = "Type"
        ncd.Width = 60
        ncd.DataType = odGridControls.nbfColumnDataType.nbfDataTypeString
        ss.nbfGrid1.Columns.Add(ncd)

        ncd = New odGridControls.nbfGridColumn
        ncd.PropertyName = "Text"
        ncd.ColHeader = "Text"
        ncd.Width = 60
        ncd.DataType = odGridControls.nbfColumnDataType.nbfDataTypeString
        ss.nbfGrid1.Columns.Add(ncd)

        ncd = New odGridControls.nbfGridColumn
        ncd.PropertyName = "SQLSource"
        ncd.ColHeader = "SQL Source"
        ncd.Width = 60
        ncd.DataType = odGridControls.nbfColumnDataType.nbfDataTypeString
        ss.nbfGrid1.Columns.Add(ncd)

        ncd = New odGridControls.nbfGridColumn
        ncd.PropertyName = "SQLColName"
        ncd.ColHeader = "ColName"
        ncd.Width = 60
        ncd.DataType = odGridControls.nbfColumnDataType.nbfDataTypeString
        ss.nbfGrid1.Columns.Add(ncd)

        ncd = New odGridControls.nbfGridColumn
        ncd.PropertyName = "Width"
        ncd.ColHeader = "Width"
        ncd.Width = 60
        ncd.DataType = odGridControls.nbfColumnDataType.nbfDataTypeString
        ss.nbfGrid1.Columns.Add(ncd)

        ncd = New odGridControls.nbfGridColumn
        ncd.PropertyName = "Height"
        ncd.ColHeader = "Height"
        ncd.Width = 60
        ncd.DataType = odGridControls.nbfColumnDataType.nbfDataTypeString
        ss.nbfGrid1.Columns.Add(ncd)

        ncd = New odGridControls.nbfGridColumn
        ncd.PropertyName = "Left"
        ncd.ColHeader = "Left"
        ncd.Width = 60
        ncd.DataType = odGridControls.nbfColumnDataType.nbfDataTypeString
        ss.nbfGrid1.Columns.Add(ncd)

        ncd = New odGridControls.nbfGridColumn
        ncd.PropertyName = "Top"
        ncd.ColHeader = "Top"
        ncd.Width = 60
        ncd.DataType = odGridControls.nbfColumnDataType.nbfDataTypeString
        ss.nbfGrid1.Columns.Add(ncd)

        ss.nbfGrid1.SourceObject = rs.SectionCtrls

        ss.Button2.Text = "Remove"

        ss.ShowDialog()

        If ss.CTRemove Then
            Dim bcs As nbfBrowseCtrls
            Dim bc As nbfBrowseCtrl
            If MsgBox("Remove " & rs.SectionCtrls.Item(ss.NbfGrid1.SelectedIndex).CtlType & " control " & rs.SectionCtrls.Item(ss.NbfGrid1.SelectedIndex).Name, MsgBoxStyle.YesNo + MsgBoxStyle.DefaultButton2, "Remove Control") = MsgBoxResult.Yes Then
                rs.SectionCtrls.RemoveAt(ss.NbfGrid1.SelectedIndex)
            End If
            rs.SectionCtrls.RemoveAt(ss.NbfGrid1.SelectedIndex)
            MsgBox("Control Removed")
        End If
        ss.nbfGrid1.releasebinding()
    End Sub
    Private Sub btnBreaks_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnBreaks.Click
        Try
            Dim rs As nbfSQLRepSection
            rs = RSS.Item(NbfGrid1.SelectedIndex)
            Dim asct As New nbfAddSection
            asct.sqs = sqs
            asct.AppFrmSI = pvSI
            asct.nbfGrid1.AllowEdit = False
            asct.bcs = rs.BreakColumns
            asct.nbfGrid1.SourceObject = asct.bcs
            asct.nbfGrid1.ColHeadersVisible = False
            asct.nbfGrid1.RowHeadersVisible = False
            If rs.SectionType = "S"
                asct.RadioButton5.Checked = True
                asct.Label1.Enabled = True
                asct.nbfGrid1.Enabled = True
                asct.Button1.Enabled = True
            Else
                asct.Label1.Enabled = false
                asct.nbfGrid1.Enabled = false
                asct.Button1.Enabled = False
                If rs.SectionType = "H" then
                    asct.RadioButton1.Checked = True
                ElseIf rs.SectionType = "P"
                    asct.RadioButton3.Checked = True
                End if
            End if
            asct.RadioButton1.enabled = false
            asct.RadioButton3.enabled = false
            asct.RadioButton5.enabled = false
            asct.Button1.enabled = false
            asct.Button4.enabled = false
            asct.Button3.visible = false
            if rs.SectionHead then
                asct.CheckSuppFoot.Enabled = False
            Else
                asct.CheckSuppHead.Enabled = False
            End If
            asct.ShowDialog()
            if rs.SectionHead then
                If asct.CheckSuppHead.Checked Then
                    rs.Suppress = True
                End If
            Else
                If asct.CheckSuppFoot.Checked Then
                    rs.Suppress = True
                End If
            End if
            If asct.CheckPBBefore.Checked Then
                rs.PageBreakBefore = True
            End If
            If asct.CheckPBAfter.Checked Then
                rs.PageBreakAfter = True
            End If
            Me.Invalidate()
            asct.nbfGrid1.ReleaseBinding
        Catch ex As Exception
            MsgBox(ex.Message)
        End Try
    End Sub
End Class

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