Imports System.Data
Imports GrapeCity.Spreadsheet
Imports Spread.Common.Features.Spread.Common.Features.Sample

Public Class TableBinding
    Inherits BaseSampleControl
    Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        Dim dt As DataTable = New DataTable()
        dt.Columns.AddRange(New DataColumn() {New DataColumn("Name"), New DataColumn("Address"), New DataColumn("City"), New DataColumn("State"), New DataColumn("ZIP", GetType(Integer))})
        dt.Rows.Add(New Object() {"Fred Smith", "123 Avalon Ave", "Denver", "CO", 80201})
        dt.Rows.Add(New Object() {"Sally Jones", "234 Beverly Blvd", "Birmingham", "AL", 35068})
        dt.Rows.Add(New Object() {"Alice West", "345 Main St", "Las Vegas", "NV", 89106})
        Dim wks As IWorksheet = fpSpread1_Sheet1.AsWorksheet()
        Dim tbl As ITable = wks.Tables.Add(wks.Range("A1:E4"), YesNoGuess.Yes)
        tbl.DataSource = dt
        wks.Columns("A:E").AutoFit()
    End Sub

    Private Sub NameManagerToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles NameManagerToolStripMenuItem.Click
        fpSpread1.ShowListCustomNameForm(Me.ParentForm)
    End Sub
End Class


'
'TableBinding.Designer.vb
'


Imports System.Windows.Forms

<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()>
Partial Class TableBinding
    ''' <summary> 
    ''' Clean up any resources being used.
    ''' </summary>
    ''' <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
    Protected Shadows Sub Dispose(disposing As Boolean)
        If disposing AndAlso (components IsNot Nothing) Then
            components.Dispose()
        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.
    <System.Diagnostics.DebuggerStepThrough()>
    Private Sub InitializeComponent()
        Dim resources As System.ComponentModel.ComponentResourceManager = New System.ComponentModel.ComponentResourceManager(GetType(TableBinding))
        Me.splitContainer1 = New System.Windows.Forms.SplitContainer()
        Me.splitContainer2 = New System.Windows.Forms.SplitContainer()
        Me.nameBox1 = New FarPoint.Win.Spread.NameBox()
        Me.fpSpread1 = New FarPoint.Win.Spread.FpSpread(FarPoint.Win.Spread.LegacyBehaviors.None, CType(resources.GetObject("splitContainer2.Panel1.Controls"), Object))
        Me.fpSpread1_Sheet1 = Me.fpSpread1.GetSheet(0)
        Me.panel1 = New System.Windows.Forms.Panel()
        Me.formulaTextBox1 = New FarPoint.Win.Spread.FormulaTextBox()
        Me.menuStrip1 = New System.Windows.Forms.MenuStrip()
        Me.NameManagerToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem()
        Me.pnlMain.SuspendLayout()
        CType(Me.splitContainer1, System.ComponentModel.ISupportInitialize).BeginInit()
        Me.splitContainer1.Panel1.SuspendLayout()
        Me.splitContainer1.Panel2.SuspendLayout()
        Me.splitContainer1.SuspendLayout()
        CType(Me.splitContainer2, System.ComponentModel.ISupportInitialize).BeginInit()
        Me.splitContainer2.Panel1.SuspendLayout()
        Me.splitContainer2.Panel2.SuspendLayout()
        Me.splitContainer2.SuspendLayout()
        CType(Me.fpSpread1, System.ComponentModel.ISupportInitialize).BeginInit()
        Me.panel1.SuspendLayout()
        Me.menuStrip1.SuspendLayout()
        Me.SuspendLayout()
        '
        'pnlMain
        '
        Me.pnlMain.Controls.Add(Me.splitContainer1)
        Me.pnlMain.Size = New System.Drawing.Size(600, 450)
        '
        'pnlControls
        '
        Me.pnlControls.Size = New System.Drawing.Size(199, 450)
        '
        'splitContainer1
        '
        Me.splitContainer1.Dock = System.Windows.Forms.DockStyle.Fill
        Me.splitContainer1.Location = New System.Drawing.Point(0, 0)
        Me.splitContainer1.Name = "splitContainer1"
        Me.splitContainer1.Orientation = System.Windows.Forms.Orientation.Horizontal
        '
        'splitContainer1.Panel1
        '
        Me.splitContainer1.Panel1.Controls.Add(Me.splitContainer2)
        Me.splitContainer1.Panel1MinSize = 21
        '
        'splitContainer1.Panel2
        '
        Me.splitContainer1.Panel2.Controls.Add(Me.fpSpread1)
        Me.splitContainer1.Size = New System.Drawing.Size(600, 450)
        Me.splitContainer1.SplitterDistance = 26
        Me.splitContainer1.TabIndex = 3
        '
        'splitContainer2
        '
        Me.splitContainer2.Dock = System.Windows.Forms.DockStyle.Fill
        Me.splitContainer2.Location = New System.Drawing.Point(0, 0)
        Me.splitContainer2.Name = "splitContainer2"
        '
        'splitContainer2.Panel1
        '
        Me.splitContainer2.Panel1.Controls.Add(Me.nameBox1)
        '
        'splitContainer2.Panel2
        '
        Me.splitContainer2.Panel2.Controls.Add(Me.panel1)
        Me.splitContainer2.Size = New System.Drawing.Size(600, 26)
        Me.splitContainer2.SplitterDistance = 199
        Me.splitContainer2.TabIndex = 0
        '
        'nameBox1
        '
        Me.nameBox1.Dock = System.Windows.Forms.DockStyle.Fill
        Me.nameBox1.Location = New System.Drawing.Point(0, 0)
        Me.nameBox1.MaxLength = 255
        Me.nameBox1.Name = "nameBox1"
        Me.nameBox1.Size = New System.Drawing.Size(199, 21)
        Me.nameBox1.TabIndex = 0
        'Attach nameBox1 to fpSpread1
        Me.nameBox1.Attach(Me.fpSpread1)
        '
        'fpSpread1
        '
        Me.fpSpread1.AccessibleDescription = "Book1, Sheet1, Row 0, Column 0"
        Me.fpSpread1.Dock = System.Windows.Forms.DockStyle.Fill
        Me.fpSpread1.Font = New System.Drawing.Font("Calibri", 11.0!)
        Me.fpSpread1.Location = New System.Drawing.Point(0, 0)
        Me.fpSpread1.Name = "fpSpread1"
        Me.fpSpread1.Size = New System.Drawing.Size(600, 420)
        Me.fpSpread1.TabIndex = 0
        '
        'panel1
        '
        Me.panel1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle
        Me.panel1.Controls.Add(Me.formulaTextBox1)
        Me.panel1.Dock = System.Windows.Forms.DockStyle.Fill
        Me.panel1.Location = New System.Drawing.Point(0, 0)
        Me.panel1.Name = "panel1"
        Me.panel1.Size = New System.Drawing.Size(397, 26)
        Me.panel1.TabIndex = 0
        '
        'formulaTextBox1
        '
        Me.formulaTextBox1.BorderStyle = System.Windows.Forms.BorderStyle.None
        Me.formulaTextBox1.Dock = System.Windows.Forms.DockStyle.Fill
        Me.formulaTextBox1.Location = New System.Drawing.Point(0, 0)
        Me.formulaTextBox1.Name = "formulaTextBox1"
        Me.formulaTextBox1.Size = New System.Drawing.Size(395, 24)
        Me.formulaTextBox1.TabIndex = 0
        'Attach formulaTextBox1 to fpSpread1
        Me.formulaTextBox1.Attach(Me.fpSpread1)
        '
        'menuStrip1
        '
        Me.menuStrip1.Items.AddRange(New System.Windows.Forms.ToolStripItem() {Me.NameManagerToolStripMenuItem})
        Me.menuStrip1.Location = New System.Drawing.Point(0, 0)
        Me.menuStrip1.Name = "menuStrip1"
        Me.menuStrip1.Size = New System.Drawing.Size(800, 24)
        Me.menuStrip1.TabIndex = 2
        Me.menuStrip1.Text = "menuStrip1"
        '
        'NameManagerToolStripMenuItem
        '
        Me.NameManagerToolStripMenuItem.Name = "NameManagerToolStripMenuItem"
        Me.NameManagerToolStripMenuItem.Size = New System.Drawing.Size(101, 20)
        Me.NameManagerToolStripMenuItem.Text = "Name Manager"
        '
        'TableBinding
        '
        Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
        Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
        Me.Controls.Add(Me.menuStrip1)
        Me.Name = "TableBinding"
        Me.Size = New System.Drawing.Size(800, 450)
        Me.pnlMain.ResumeLayout(False)
        Me.splitContainer1.Panel1.ResumeLayout(False)
        Me.splitContainer1.Panel2.ResumeLayout(False)
        CType(Me.splitContainer1, System.ComponentModel.ISupportInitialize).EndInit()
        Me.splitContainer1.ResumeLayout(False)
        Me.splitContainer2.Panel1.ResumeLayout(False)
        Me.splitContainer2.Panel2.ResumeLayout(False)
        CType(Me.splitContainer2, System.ComponentModel.ISupportInitialize).EndInit()
        Me.splitContainer2.ResumeLayout(False)
        CType(Me.fpSpread1, System.ComponentModel.ISupportInitialize).EndInit()
        Me.panel1.ResumeLayout(False)
        Me.menuStrip1.ResumeLayout(False)
        Me.menuStrip1.PerformLayout()
        Me.ResumeLayout(False)
        Me.PerformLayout()

    End Sub

    Private WithEvents splitContainer1 As SplitContainer
    Private WithEvents splitContainer2 As SplitContainer
    Private WithEvents nameBox1 As FarPoint.Win.Spread.NameBox
    Private WithEvents fpSpread1 As FarPoint.Win.Spread.FpSpread
    Private WithEvents panel1 As Panel
    Private WithEvents formulaTextBox1 As FarPoint.Win.Spread.FormulaTextBox
    Friend WithEvents fpSpread1_Sheet1 As FarPoint.Win.Spread.SheetView
    Private WithEvents menuStrip1 As MenuStrip
    Friend WithEvents NameManagerToolStripMenuItem As ToolStripMenuItem
End Class

