Click here to Skip to main content
15,881,424 members
Articles / Productivity Apps and Services / Microsoft Office

RefEdit Emulation for .NET

Rate me:
Please Sign up or sign in to vote.
4.75/5 (14 votes)
27 Oct 2012CPOL6 min read 91.8K   3.8K   29  
A simple implementation of a ref edit control for .NET
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
Partial Class Form1
    Inherits System.Windows.Forms.Form

    'Form overrides dispose to clean up the component list.
    <System.Diagnostics.DebuggerNonUserCode()> _
    Protected Overrides Sub Dispose(ByVal disposing As Boolean)
        Try
            If disposing AndAlso components IsNot Nothing Then
                components.Dispose()
            End If
        Finally
            MyBase.Dispose(disposing)
        End Try
    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(Form1))
        Me.Button1 = New System.Windows.Forms.Button()
        Me.TextBox1 = New System.Windows.Forms.TextBox()
        Me.TabControl1 = New System.Windows.Forms.TabControl()
        Me.TabPage1 = New System.Windows.Forms.TabPage()
        Me.Label7 = New System.Windows.Forms.Label()
        Me.Label6 = New System.Windows.Forms.Label()
        Me.TabPage2 = New System.Windows.Forms.TabPage()
        Me.Label1 = New System.Windows.Forms.Label()
        Me.Label2 = New System.Windows.Forms.Label()
        Me.Label3 = New System.Windows.Forms.Label()
        Me.Label4 = New System.Windows.Forms.Label()
        Me.Label5 = New System.Windows.Forms.Label()
        Me.chkShowSheetName = New System.Windows.Forms.CheckBox()
        Me.chkShowRowAbsolute = New System.Windows.Forms.CheckBox()
        Me.chkShowColumnAbsolute = New System.Windows.Forms.CheckBox()
        Me.GroupBox1 = New System.Windows.Forms.GroupBox()
        Me.Excel2007RefEdit1 = New LeafCreations.Excel2007RefEdit()
        Me.Excel2007RefEdit2 = New LeafCreations.Excel2007RefEdit()
        Me.Excel2007RefEdit3 = New LeafCreations.Excel2007RefEdit()
        Me.Label8 = New System.Windows.Forms.Label()
        Me.TabControl1.SuspendLayout()
        Me.TabPage1.SuspendLayout()
        Me.GroupBox1.SuspendLayout()
        Me.SuspendLayout()
        '
        'Button1
        '
        Me.Button1.Location = New System.Drawing.Point(12, 12)
        Me.Button1.Name = "Button1"
        Me.Button1.Size = New System.Drawing.Size(136, 23)
        Me.Button1.TabIndex = 1
        Me.Button1.Text = "Connect to Excel"
        Me.Button1.UseVisualStyleBackColor = True
        '
        'TextBox1
        '
        Me.TextBox1.Location = New System.Drawing.Point(19, 173)
        Me.TextBox1.Name = "TextBox1"
        Me.TextBox1.Size = New System.Drawing.Size(234, 20)
        Me.TextBox1.TabIndex = 3
        '
        'TabControl1
        '
        Me.TabControl1.Controls.Add(Me.TabPage1)
        Me.TabControl1.Controls.Add(Me.TabPage2)
        Me.TabControl1.Location = New System.Drawing.Point(12, 259)
        Me.TabControl1.Name = "TabControl1"
        Me.TabControl1.SelectedIndex = 0
        Me.TabControl1.Size = New System.Drawing.Size(384, 162)
        Me.TabControl1.TabIndex = 5
        '
        'TabPage1
        '
        Me.TabPage1.Controls.Add(Me.Label7)
        Me.TabPage1.Controls.Add(Me.Label6)
        Me.TabPage1.Controls.Add(Me.Excel2007RefEdit2)
        Me.TabPage1.Location = New System.Drawing.Point(4, 22)
        Me.TabPage1.Name = "TabPage1"
        Me.TabPage1.Padding = New System.Windows.Forms.Padding(3)
        Me.TabPage1.Size = New System.Drawing.Size(376, 136)
        Me.TabPage1.TabIndex = 0
        Me.TabPage1.Text = "TabPage1"
        Me.TabPage1.UseVisualStyleBackColor = True
        '
        'Label7
        '
        Me.Label7.Location = New System.Drawing.Point(6, 65)
        Me.Label7.Name = "Label7"
        Me.Label7.Size = New System.Drawing.Size(364, 26)
        Me.Label7.TabIndex = 11
        Me.Label7.Text = "This demonstrates the use of the control in other containers such as the tabcontr" & _
            "ol. Minimize/Maximize will no longer display a blank form."
        '
        'Label6
        '
        Me.Label6.AutoSize = True
        Me.Label6.Location = New System.Drawing.Point(6, 12)
        Me.Label6.Name = "Label6"
        Me.Label6.Size = New System.Drawing.Size(54, 13)
        Me.Label6.TabIndex = 9
        Me.Label6.Text = "RefEdit 2:"
        '
        'TabPage2
        '
        Me.TabPage2.Location = New System.Drawing.Point(4, 22)
        Me.TabPage2.Name = "TabPage2"
        Me.TabPage2.Padding = New System.Windows.Forms.Padding(3)
        Me.TabPage2.Size = New System.Drawing.Size(376, 136)
        Me.TabPage2.TabIndex = 1
        Me.TabPage2.Text = "TabPage2"
        Me.TabPage2.UseVisualStyleBackColor = True
        '
        'Label1
        '
        Me.Label1.AutoSize = True
        Me.Label1.Location = New System.Drawing.Point(16, 157)
        Me.Label1.Name = "Label1"
        Me.Label1.Size = New System.Drawing.Size(95, 13)
        Me.Label1.TabIndex = 6
        Me.Label1.Text = "RefEdit 1 Address:"
        '
        'Label2
        '
        Me.Label2.Location = New System.Drawing.Point(154, 12)
        Me.Label2.Name = "Label2"
        Me.Label2.Size = New System.Drawing.Size(317, 26)
        Me.Label2.TabIndex = 7
        Me.Label2.Text = "Click this button to instantiate a new instance of Excel or use a currently open " & _
            "instance."
        '
        'Label3
        '
        Me.Label3.AutoSize = True
        Me.Label3.Location = New System.Drawing.Point(16, 29)
        Me.Label3.Name = "Label3"
        Me.Label3.Size = New System.Drawing.Size(54, 13)
        Me.Label3.TabIndex = 8
        Me.Label3.Text = "RefEdit 1:"
        '
        'Label4
        '
        Me.Label4.Location = New System.Drawing.Point(202, 45)
        Me.Label4.Name = "Label4"
        Me.Label4.Size = New System.Drawing.Size(215, 26)
        Me.Label4.TabIndex = 9
        Me.Label4.Text = "Click this button to minimize/maximize the refedit control."
        '
        'Label5
        '
        Me.Label5.Location = New System.Drawing.Point(259, 173)
        Me.Label5.Name = "Label5"
        Me.Label5.Size = New System.Drawing.Size(215, 26)
        Me.Label5.TabIndex = 10
        Me.Label5.Text = "This is the value displayed by the 'Address' Property."
        '
        'chkShowSheetName
        '
        Me.chkShowSheetName.AutoSize = True
        Me.chkShowSheetName.Checked = True
        Me.chkShowSheetName.CheckState = System.Windows.Forms.CheckState.Checked
        Me.chkShowSheetName.Location = New System.Drawing.Point(19, 87)
        Me.chkShowSheetName.Name = "chkShowSheetName"
        Me.chkShowSheetName.Size = New System.Drawing.Size(195, 17)
        Me.chkShowSheetName.TabIndex = 11
        Me.chkShowSheetName.Text = "Show sheet name in selected range"
        Me.chkShowSheetName.UseVisualStyleBackColor = True
        '
        'chkShowRowAbsolute
        '
        Me.chkShowRowAbsolute.AutoSize = True
        Me.chkShowRowAbsolute.Checked = True
        Me.chkShowRowAbsolute.CheckState = System.Windows.Forms.CheckState.Checked
        Me.chkShowRowAbsolute.Location = New System.Drawing.Point(19, 110)
        Me.chkShowRowAbsolute.Name = "chkShowRowAbsolute"
        Me.chkShowRowAbsolute.Size = New System.Drawing.Size(250, 17)
        Me.chkShowRowAbsolute.TabIndex = 12
        Me.chkShowRowAbsolute.Text = "Show Row Absolute Indicator in selected range"
        Me.chkShowRowAbsolute.UseVisualStyleBackColor = True
        '
        'chkShowColumnAbsolute
        '
        Me.chkShowColumnAbsolute.AutoSize = True
        Me.chkShowColumnAbsolute.Checked = True
        Me.chkShowColumnAbsolute.CheckState = System.Windows.Forms.CheckState.Checked
        Me.chkShowColumnAbsolute.Location = New System.Drawing.Point(19, 133)
        Me.chkShowColumnAbsolute.Name = "chkShowColumnAbsolute"
        Me.chkShowColumnAbsolute.Size = New System.Drawing.Size(262, 17)
        Me.chkShowColumnAbsolute.TabIndex = 13
        Me.chkShowColumnAbsolute.Text = "Show Column Absolute indicator in selected range"
        Me.chkShowColumnAbsolute.UseVisualStyleBackColor = True
        '
        'GroupBox1
        '
        Me.GroupBox1.Controls.Add(Me.Label3)
        Me.GroupBox1.Controls.Add(Me.chkShowColumnAbsolute)
        Me.GroupBox1.Controls.Add(Me.TextBox1)
        Me.GroupBox1.Controls.Add(Me.chkShowRowAbsolute)
        Me.GroupBox1.Controls.Add(Me.Excel2007RefEdit1)
        Me.GroupBox1.Controls.Add(Me.chkShowSheetName)
        Me.GroupBox1.Controls.Add(Me.Label1)
        Me.GroupBox1.Controls.Add(Me.Label5)
        Me.GroupBox1.Controls.Add(Me.Label4)
        Me.GroupBox1.Location = New System.Drawing.Point(12, 41)
        Me.GroupBox1.Name = "GroupBox1"
        Me.GroupBox1.Size = New System.Drawing.Size(477, 212)
        Me.GroupBox1.TabIndex = 14
        Me.GroupBox1.TabStop = False
        Me.GroupBox1.Text = "GroupBox1"
        '
        'Excel2007RefEdit1
        '
        Me.Excel2007RefEdit1.Address = ""
        Me.Excel2007RefEdit1.BackColor = System.Drawing.Color.Transparent
        Me.Excel2007RefEdit1.ExcelConnector = Nothing
        Me.Excel2007RefEdit1.ImageMaximized = CType(resources.GetObject("Excel2007RefEdit1.ImageMaximized"), System.Drawing.Image)
        Me.Excel2007RefEdit1.ImageMinimized = CType(resources.GetObject("Excel2007RefEdit1.ImageMinimized"), System.Drawing.Image)
        Me.Excel2007RefEdit1.Location = New System.Drawing.Point(19, 45)
        Me.Excel2007RefEdit1.Name = "Excel2007RefEdit1"
        Me.Excel2007RefEdit1.Size = New System.Drawing.Size(177, 27)
        Me.Excel2007RefEdit1.TabIndex = 2
        '
        'Excel2007RefEdit2
        '
        Me.Excel2007RefEdit2.Address = Nothing
        Me.Excel2007RefEdit2.BackColor = System.Drawing.Color.Transparent
        Me.Excel2007RefEdit2.ExcelConnector = Nothing
        Me.Excel2007RefEdit2.ImageMaximized = CType(resources.GetObject("Excel2007RefEdit2.ImageMaximized"), System.Drawing.Image)
        Me.Excel2007RefEdit2.ImageMinimized = CType(resources.GetObject("Excel2007RefEdit2.ImageMinimized"), System.Drawing.Image)
        Me.Excel2007RefEdit2.Location = New System.Drawing.Point(66, 6)
        Me.Excel2007RefEdit2.Name = "Excel2007RefEdit2"
        Me.Excel2007RefEdit2.Size = New System.Drawing.Size(195, 27)
        Me.Excel2007RefEdit2.TabIndex = 4
        '
        'Excel2007RefEdit3
        '
        Me.Excel2007RefEdit3.Address = Nothing
        Me.Excel2007RefEdit3.BackColor = System.Drawing.Color.Transparent
        Me.Excel2007RefEdit3.ExcelConnector = Nothing
        Me.Excel2007RefEdit3.ImageMaximized = CType(resources.GetObject("Excel2007RefEdit3.ImageMaximized"), System.Drawing.Image)
        Me.Excel2007RefEdit3.ImageMinimized = CType(resources.GetObject("Excel2007RefEdit3.ImageMinimized"), System.Drawing.Image)
        Me.Excel2007RefEdit3.Location = New System.Drawing.Point(70, 440)
        Me.Excel2007RefEdit3.Name = "Excel2007RefEdit3"
        Me.Excel2007RefEdit3.Size = New System.Drawing.Size(195, 27)
        Me.Excel2007RefEdit3.TabIndex = 15
        '
        'Label8
        '
        Me.Label8.AutoSize = True
        Me.Label8.Location = New System.Drawing.Point(12, 440)
        Me.Label8.Name = "Label8"
        Me.Label8.Size = New System.Drawing.Size(54, 13)
        Me.Label8.TabIndex = 16
        Me.Label8.Text = "RefEdit 3:"
        '
        'Form1
        '
        Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
        Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
        Me.BackColor = System.Drawing.Color.White
        Me.ClientSize = New System.Drawing.Size(502, 502)
        Me.Controls.Add(Me.Label8)
        Me.Controls.Add(Me.Excel2007RefEdit3)
        Me.Controls.Add(Me.GroupBox1)
        Me.Controls.Add(Me.Label2)
        Me.Controls.Add(Me.TabControl1)
        Me.Controls.Add(Me.Button1)
        Me.Name = "Form1"
        Me.Text = "Form1"
        Me.TopMost = True
        Me.TabControl1.ResumeLayout(False)
        Me.TabPage1.ResumeLayout(False)
        Me.TabPage1.PerformLayout()
        Me.GroupBox1.ResumeLayout(False)
        Me.GroupBox1.PerformLayout()
        Me.ResumeLayout(False)
        Me.PerformLayout()

    End Sub
    Friend WithEvents Button1 As System.Windows.Forms.Button
    Friend WithEvents Excel2007RefEdit1 As LeafCreations.Excel2007RefEdit
    Friend WithEvents TextBox1 As System.Windows.Forms.TextBox
    Friend WithEvents Excel2007RefEdit2 As LeafCreations.Excel2007RefEdit
    Friend WithEvents TabControl1 As System.Windows.Forms.TabControl
    Friend WithEvents TabPage1 As System.Windows.Forms.TabPage
    Friend WithEvents TabPage2 As System.Windows.Forms.TabPage
    Friend WithEvents Label7 As System.Windows.Forms.Label
    Friend WithEvents Label6 As System.Windows.Forms.Label
    Friend WithEvents Label1 As System.Windows.Forms.Label
    Friend WithEvents Label2 As System.Windows.Forms.Label
    Friend WithEvents Label3 As System.Windows.Forms.Label
    Friend WithEvents Label4 As System.Windows.Forms.Label
    Friend WithEvents Label5 As System.Windows.Forms.Label
    Friend WithEvents chkShowSheetName As System.Windows.Forms.CheckBox
    Friend WithEvents chkShowRowAbsolute As System.Windows.Forms.CheckBox
    Friend WithEvents chkShowColumnAbsolute As System.Windows.Forms.CheckBox
    Friend WithEvents GroupBox1 As System.Windows.Forms.GroupBox
    Friend WithEvents Excel2007RefEdit3 As LeafCreations.Excel2007RefEdit
    Friend WithEvents Label8 As System.Windows.Forms.Label

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
Software Developer
United States United States
I am a .NET/Office/SQL programmer. Although by day I work for as a software developer for a big distribution company, by night I enjoy creating things. My major nocturnal project is Office Ribbon Editor (http://www.leafcreations.org).

I have dabbled in such languages as java, c, c++, php, cf, objective C and even cobol. At this moment, I am sticking with the .NET languages.

Comments and Discussions