Imports System.Collections.Generic
Imports System.ComponentModel
Imports System.Drawing
Imports System.Data
Imports System.Linq
Imports System.Text
Imports System.Threading.Tasks
Imports System.Windows.Forms
Imports Spread.Common.Features.Spread.Common.Features.Sample
Imports FarPoint.Win
Imports FarPoint.Win.Spread
Imports FarPoint.Win.Spread.CellType
Imports GrapeCity.Win.Spread.InputMan.CellType
Imports GrapeCity.Win.Spread.InputMan.CellType.Fields
Imports GrapeCity.Spreadsheet

Public Partial Class DataValidation
	Inherits BaseSampleControl
	Private _fclrHeader As System.Drawing.Color = System.Drawing.Color.White
	Private _bclrHeader As System.Drawing.Color = System.Drawing.Color.Purple
	Private _subHeaderColor As System.Drawing.Color = System.Drawing.Color.LightPink, _validationColor As System.Drawing.Color = System.Drawing.Color.LightGoldenrodYellow

	Private _fntHeader As New System.Drawing.Font("Segoi Ui", 10, System.Drawing.FontStyle.Bold)
	Private _lineBorder As New LineBorder(System.Drawing.Color.Black)
	Public Sub New()
		InitializeComponent()
		Name = "Excel-compatible Data Validation"

        Dim container As SplitContainer = TryCast(Me.pnlControls.Parent.Parent, SplitContainer)
        AddHandler fpSpread.ActiveSheetChanged, Function(s, e) InlineAssignHelper(container.Panel2Collapsed, Not (fpSpread.ActiveSheetIndex = 0))

		'#Region "Data Validation Introduction Sheet"
		Dim row As Integer = 0, col As Integer = 0
		_sheetIntro.SetColumnWidth(-1, 120)
		_sheetIntro.SetRowHeight(-1, 18)

		'Whole Number Validator
		SetHeaderAndBoundary(_sheetIntro, row, col, 2, 12, 1, _
			1, "Whole Number Validations")
		_sheetIntro.Cells(row + 3, col).BackColor = InlineAssignHelper(_sheetIntro.Cells(row + 5, col).BackColor, InlineAssignHelper(_sheetIntro.Cells(row + 7, col).BackColor, _subHeaderColor))
		_sheetIntro.Cells(row + 3, col + 1).BackColor = InlineAssignHelper(_sheetIntro.Cells(row + 5, col + 1).BackColor, InlineAssignHelper(_sheetIntro.Cells(row + 7, col + 1).BackColor, _validationColor))

		_sheetIntro.Cells(row + 3, col).Text = "Between :"
		_sheetIntro.Cells(row + 3, col + 1).Value = 5
		_sheetIntro.Cells(row + 3, col + 1).Validation.Add(DataValidationType.WholeNumber, DataValidationErrorStyle.[Stop], DataValidationOperator.Between, "1", "9")
		AddValidationActions(row + 3, col + 1, 1, 1, True, String.Empty, _
			String.Empty, True, "Whole Number Validator", "This cell accepts only whole numbers between 1 and 9.")

		_sheetIntro.Cells(row + 5, col).Text = "Less than or equal :"
		_sheetIntro.Cells(row + 5, col + 1).Value = 50
		_sheetIntro.Cells(row + 5, col + 1).Validation.Add(DataValidationType.WholeNumber, DataValidationErrorStyle.[Stop], DataValidationOperator.LessThanOrEqual, "100")
		AddValidationActions(row + 5, col + 1, 1, 1, True, String.Empty, _
			String.Empty, True, "Whole Number Validator", "This cell accepts only whole numbers <=100")

		_sheetIntro.Cells(row + 7, col).Text = "Formula :"
		_sheetIntro.Cells(row + 7, col + 1).Value = 30
		_sheetIntro.Cells(row + 7, col + 1).Validation.Add(DataValidationType.WholeNumber, DataValidationErrorStyle.[Stop], DataValidationOperator.GreaterThanOrEqual, "=B6/2")
		AddValidationActions(row + 7, col + 1, 1, 1, True, String.Empty, _
			String.Empty, True, "Whole Number Validator", "This cell accepts only whole numbers >= (B6)/2")

		'Decimal and text length validators
		SetHeaderAndBoundary(_sheetIntro, row + 9, col, 2, 12, 1, _
			1, "TextLength & Decimal Validations")
		SubHeaderStyling(_sheetIntro, row + 12, col, 6, 4, 0, _
			2)
		_sheetIntro.SetClipValue(row + 12, col, 6, 4, "Product" & vbTab & "Price" & vbTab & "Tax" & vbTab & "Total" & vbLf & "Apple" & vbTab & "10" & vbTab & "0.05" & vbLf & "Orange" & vbTab & "20" & vbTab & "0.10" & vbLf & "Coconut" & vbTab & "35" & vbTab & "0.075" & vbLf & "Pear" & vbTab & "30" & vbTab & "0.08" & vbLf & "Grape" & vbTab & "40" & vbTab & "0.09")
		_sheetIntro.Cells(row + 13, col + 1, row + 17, col + 1).CellType = New CurrencyCellType()
		_sheetIntro.Cells(row + 13, col + 2, row + 17, col + 2).CellType = New PercentCellType()
		_sheetIntro.Cells(row + 13, col + 3, row + 17, col + 3).CellType = New CurrencyCellType()
		_sheetIntro.Cells(row + 13, col + 3, row + 17, col + 3).Formula = "$B14+$B14*$C14"

		_sheetIntro.Cells(row + 13, col, row + 17, col).Validation.Add(DataValidationType.TextLength, DataValidationErrorStyle.[Stop], DataValidationOperator.LessThan, "15")
		AddValidationActions(row + 13, col, 5, 1, True, String.Empty, _
			String.Empty, True, String.Empty, "Text Length <15 characters")

		_sheetIntro.Cells(row + 13, col + 2, row + 17, col + 2).Validation.Add(DataValidationType.[Decimal], DataValidationErrorStyle.[Stop], DataValidationOperator.Between, "0.01", "0.1")
		AddValidationActions(row + 13, col + 2, 5, 1, True, String.Empty, _
			String.Empty, True, String.Empty, "Tax must be between 1% and 10%")

		'List and Date validators
		SetHeaderAndBoundary(_sheetIntro, row + 19, col, 2, 12, 1, _
			1, "List & Date Validations")
		SubHeaderStyling(_sheetIntro, row + 22, col, 4, 5, 0, _
			1, 2)
		_sheetIntro.SetClipValue(row + 22, col, 1, 5, "Product" & vbTab & "From Date" & vbTab & "To Date" & vbTab & "Units Sold" & vbTab & "Total Amount")
		_sheetIntro.Cells(row + 23, col + 1, row + 25, col + 2).CellType = New DateTimeCellType()
		_sheetIntro.Cells(row + 23, col + 3, row + 25, col + 3).CellType = New CurrencyCellType()

		_sheetIntro.Cells(row + 23, col, row + 25, col).Validation.Add(DataValidationType.List, DataValidationErrorStyle.[Stop], DataValidationOperator.Equal, "=$A$14:$A$18")
		AddValidationActions(row + 23, col, 3, 1, True, String.Empty, _
			String.Empty, True, String.Empty, String.Empty)

		_sheetIntro.Cells(row + 23, col + 1, row + 25, col + 1).Validation.Add(DataValidationType.[Date], DataValidationErrorStyle.[Stop], DataValidationOperator.Between, "=DATE(YEAR(NOW()),1,1)", "=TODAY()")
		AddValidationActions(row + 23, col + 1, 3, 1, True, String.Empty, _
			String.Empty, True, String.Empty, "From Date must be between start & current date of current year")

		_sheetIntro.Cells(row + 23, col + 2, row + 25, col + 2).Validation.Add(DataValidationType.[Date], DataValidationErrorStyle.[Stop], DataValidationOperator.Between, "=$B24", "=TODAY()")
		AddValidationActions(row + 23, col + 2, 3, 1, True, String.Empty, _
			String.Empty, True, String.Empty, "From Date must be between selected From Date & current date of current year")

		_sheetIntro.Cells(row + 23, col + 3, row + 25, col + 3).Formula = "IF(OR($A24="""",$B24="""",$C24=""""), 0, DATEDIF($B24,$C24,""D"")) * 3"
		_sheetIntro.Cells(row + 23, col + 4, row + 25, col + 4).Formula = "IF(OR($A24="""",$D24=0),0,VLOOKUP($A24,$A$14:$D$18,4,FALSE)) * $D24"

		'Time and Custom Validations
		SetHeaderAndBoundary(_sheetIntro, row + 27, col, 2, 12, 1, _
			1, "Time & Custom Validations")
		SubHeaderStyling(_sheetIntro, row + 30, col, 6, 6, 0, _
			2, 3, 4)
		_sheetIntro.SetClip(row + 30, col, 6, 6, "ID" & vbTab & "Name" & vbTab & "Email" & vbTab & "Entry Time" & vbTab & "Exit Time" & vbTab & "Work Duration" & vbLf & "1" & vbTab & "Emily" & vbTab & "Emily@mescius.com" & vbLf & "2" & vbTab & "Sarah" & vbTab & "Sarah@mescius.com" & vbLf & "3" & vbTab & "Lily" & vbTab & "Lily@mescius.com" & vbLf & "4" & vbTab & "Anna" & vbTab & "Anna@mescius.com" & vbLf & "5" & vbTab & "Daisy" & vbTab & "Daisy@mescius.com")
        Dim timeSpanCellType As New GcTimeSpanCellType()
        timeSpanCellType.Fields.Clear()
		timeSpanCellType.Fields.AddRange(New TimeSpanFieldCollectionInfo() From { _
			New TimeSpanHourFieldInfo(2), _
			New TimeSpanLiteralFieldInfo(":"), _
			New TimeSpanMinuteFieldInfo(2), _
			New TimeSpanLiteralFieldInfo(":"), _
			New TimeSpanSecondFieldInfo(2) _
		})
		_sheetIntro.Cells(row + 31, col + 3, row + 35, col + 4).CellType = timeSpanCellType

		_sheetIntro.Cells(row + 31, col + 3, row + 35, col + 3).Validation.Add(DataValidationType.Time, DataValidationErrorStyle.[Stop], DataValidationOperator.Between, "=TIME(8,0,0)", "=TIME(17,0,0)")
		AddValidationActions(row + 31, col + 3, 5, 1, True, String.Empty, _
			String.Empty, True, String.Empty, "Entry time must be between 8Am and 5PM")
		_sheetIntro.Cells(row + 31, col + 4, row + 35, col + 4).Validation.Add(DataValidationType.Time, DataValidationErrorStyle.[Stop], DataValidationOperator.Between, "=$D32", "=TIME(17,0,0)")
		AddValidationActions(row + 31, col + 4, 5, 1, True, String.Empty, _
			String.Empty, True, String.Empty, "Exit time must be between Entry Time and 5PM")

        _sheetIntro.Cells(row + 31, col + 5, row + 35, col + 5).CellType = New DateTimeCellType() With {
             .DateTimeFormat = DateTimeFormat.TimeOnly
        }
        _sheetIntro.Cells(row + 31, col + 5, row + 35, col + 5).Formula = "IF(OR($D32="""", $E32=""""),0, $E32-$D32)"

		_sheetIntro.Cells(row + 31, col + 2, row + 35, col + 2).Validation.Add(DataValidationType.[Custom], DataValidationErrorStyle.[Stop], DataValidationOperator.Between, "=ISNUMBER(FIND(""@"",C32))")
		AddValidationActions(row + 31, col + 2, 5, 1, True, String.Empty, _
			String.Empty, True, String.Empty, "Email must have a format of abc@xyz.")

		_sheetIntro.Cells(row + 31, col, row + 35, col).Validation.Add(DataValidationType.[Custom], DataValidationErrorStyle.[Stop], DataValidationOperator.Between, "=COUNTIF($A$32:$A$36, $A32)=1")
		AddValidationActions(row + 31, col, 5, 1, True, String.Empty, _
			String.Empty, True, String.Empty, "Values should be unique in the cell range $A$32:$A$36")
		'#End Region

		'#Region "Products sheet"
		Dim startRow1 As Integer = 0, startCol1 As Integer = 0
		_sheetProducts.Rows(startRow1).Height = 25

		SetHeaderAndBoundary(_sheetProducts, startRow1, startCol1, 1, 1, 3, _
			1)
		_sheetProducts.SetClip(startRow1, startCol1, 3, 1, "Category" & vbLf & "Marker" & vbLf & "Pen")

		SetHeaderAndBoundary(_sheetProducts, startRow1, startCol1 + 2, 1, 2, 5, _
			2)
		_sheetProducts.SetClip(startRow1, startCol1 + 2, 5, 1, "Markers" & vbLf & "Gold" & vbLf & "Permanent" & vbLf & "Silver" & vbLf & "White paint")
		_sheetProducts.SetClip(startRow1 + 1, startCol1 + 3, 4, 1, "4.29" & vbLf & "1.49" & vbLf & "3.99" & vbLf & "3.99")

		SetHeaderAndBoundary(_sheetProducts, startRow1, startCol1 + 5, 1, 2, 10, _
			2)
		_sheetProducts.SetClip(startRow1, startCol1 + 5, 10, 1, "Pens" & vbLf & "Flexgrip highlighter" & vbLf & "Gripper ball" & vbLf & "Retractable" & vbLf & "roundedge stick pens" & vbLf & "Rubber grip" & vbLf & "Rubberstik" & vbLf & "Stainless steel ballpoint" & vbLf & "Stick pen" & vbLf & "Twist erase pencil")
		_sheetProducts.SetClip(startRow1 + 1, startCol1 + 6, 9, 1, "1.49" & vbLf & "1.29" & vbLf & "4.99" & vbLf & "1.2" & vbLf & "0.95" & vbLf & "0.69" & vbLf & "9.99" & vbLf & "0.59" & vbLf & "6.49")

		_sheetProducts.Cells(startRow1 + 1, startCol1 + 3, startRow1 + 4, startCol1 + 3).CellType = New CurrencyCellType()
		_sheetProducts.Cells(startRow1 + 1, startCol1 + 6, startRow1 + 9, startCol1 + 6).CellType = New CurrencyCellType()

		_sheetProducts.AddCustomName("Categories", "Products!$A$2:$A$3", 0, 0)
		_sheetProducts.AddCustomName("Marker", "Products!$C$2:$C$5", 0, 0)
		_sheetProducts.AddCustomName("MarkerPrice", "Products!$C$2:$D$5", 0, 0)
		_sheetProducts.AddCustomName("Pen", "Products!$F$2:$F$10", 0, 0)
		_sheetProducts.AddCustomName("PenPrice", "Products!$F$2:$G$10", 0, 0)
		'#End Region

		'#Region "OrdersForm Sheet"
		Dim startRow2 As Integer = 2, startCol2 As Integer = 1
		_sheetOrderForm.SetRowHeight(-1, 20)
		_sheetOrderForm.Rows(2).Height = 30
		SetHeaderAndBoundary(_sheetOrderForm, startRow2, startCol2, 1, 4)
		_sheetOrderForm.Cells(startRow2, startCol2).Text = "Order Form"

		SetHeaderAndBoundary(_sheetOrderForm, startRow2, startCol2 + 4)
		_sheetOrderForm.Cells(startRow2, startCol2 + 4).Formula = "TODAY()"
		_sheetOrderForm.Cells(startRow2, startCol2 + 4).CellType = New DateTimeCellType()

		SetHeaderAndBoundary(_sheetOrderForm, startRow2 + 2, startCol2, 1, 1, 9, _
			5)
		_sheetOrderForm.SetClip(startRow2 + 2, startCol2, 1, 5, "Category" & vbTab & "Description" & vbTab & "Unit Cost" & vbTab & "Units" & vbTab & "Total Cost")
		'Data Validations
		_sheetOrderForm.Validations.Add(startRow2 + 3, startCol2, startRow2 + 10, startCol2, GrapeCity.Spreadsheet.DataValidationType.List, GrapeCity.Spreadsheet.DataValidationErrorStyle.Warning, _
			GrapeCity.Spreadsheet.DataValidationOperator.Equal, "=Categories")
		_sheetOrderForm.Validations.Add(startRow2 + 3, startCol2 + 1, startRow2 + 10, startCol2 + 1, GrapeCity.Spreadsheet.DataValidationType.List, GrapeCity.Spreadsheet.DataValidationErrorStyle.Warning, _
			GrapeCity.Spreadsheet.DataValidationOperator.Equal, "=INDIRECT(B6)")
		'Formulas
		_sheetOrderForm.Cells(startRow2 + 3, startCol2 + 2, startRow2 + 10, startCol2 + 2).Formula = "IF(C6="""","""",VLOOKUP(C6,INDIRECT(B6&""Price""),2,FALSE))"
		_sheetOrderForm.Cells(startRow2 + 3, startCol2 + 4, startRow2 + 10, startCol2 + 4).Formula = "IF(C6="""","""",D6*E6)"
		'CellTypes
		_sheetOrderForm.Cells(startRow2 + 3, startCol2 + 2, startRow2 + 10, startCol2 + 2).CellType = New CurrencyCellType()
		_sheetOrderForm.Cells(startRow2 + 3, startCol2 + 4, startRow2 + 11, startCol2 + 4).CellType = New CurrencyCellType()
		_sheetOrderForm.Cells(startRow2 + 3, startCol2 + 3, startRow2 + 10, startCol2 + 3).Value = 10

		SetHeaderAndBoundary(_sheetOrderForm, startRow2 + 11, startCol2, 1, 4)
		_sheetOrderForm.Cells(startRow2 + 11, startCol2).Text = "Sub Total:"
		SetHeaderAndBoundary(_sheetOrderForm, startRow2 + 11, startCol2 + 4, 1, 1)
		_sheetOrderForm.Cells(startRow2 + 11, startCol2 + 4).Formula = "SUM(F6:F13)"

		'GST and PST section
		_sheetOrderForm.Cells(startRow2 + 14, startCol2 + 2, startRow2 + 15, startCol2 + 4).Border = _lineBorder
        _sheetOrderForm.Cells(startRow2 + 14, startCol2 + 2).CellType = New CheckBoxCellType() With {
             .TextTrue = "PST",
             .TextFalse = "PST"
        }
        _sheetOrderForm.Cells(startRow2 + 15, startCol2 + 2).CellType = New CheckBoxCellType() With {
             .TextTrue = "GST",
             .TextFalse = "GST"
        }

        _sheetOrderForm.Cells(startRow2 + 14, startCol2 + 3).CellType = New PercentCellType()
		_sheetOrderForm.Cells(startRow2 + 14, startCol2 + 3).Value = 0.08
		_sheetOrderForm.Cells(startRow2 + 15, startCol2 + 3).CellType = New PercentCellType()
		_sheetOrderForm.Cells(startRow2 + 15, startCol2 + 3).Value = 0.07

		_sheetOrderForm.Cells(startRow2 + 14, startCol2 + 4).Formula = "D17*F14*E17"
		_sheetOrderForm.Cells(startRow2 + 15, startCol2 + 4).Formula = "D18*F14*E18"

		SetHeaderAndBoundary(_sheetOrderForm, startRow2 + 16, startCol2 + 2, 1, 2)
		SetHeaderAndBoundary(_sheetOrderForm, startRow2 + 16, startCol2 + 4)
		_sheetOrderForm.Cells(startRow2 + 16, startCol2 + 2).Text = "Total:"
		_sheetOrderForm.Cells(startRow2 + 16, startCol2 + 4).Formula = "F14+F17+F18"
			'#End Region
		_sheetOrderForm.Cells(startRow2 + 14, startCol2 + 4, startRow2 + 17, startCol2 + 4).CellType = New CurrencyCellType()
	End Sub

	Private Sub SetHeaderAndBoundary(sheet As SheetView, row As Integer, col As Integer, Optional rowSpan As Integer = 1, Optional colSpan As Integer = 1, Optional rowCount As Integer = 1, _
		Optional colCount As Integer = 1, Optional header As String = "")
		sheet.Cells(row, col).ColumnSpan = colSpan
		sheet.Cells(row, col).RowSpan = rowSpan
		sheet.Cells(row, col, row, col + colCount - 1).BackColor = _bclrHeader
		sheet.Cells(row, col, row, col + colCount - 1).ForeColor = _fclrHeader
		sheet.Cells(row, col, row, col + colCount - 1).VerticalAlignment = CellVerticalAlignment.Center
		sheet.Cells(row, col, row, col + colCount - 1).Font = _fntHeader
		sheet.Cells(row, col, row + rowCount - 1, col + colCount - 1).Border = _lineBorder
		sheet.Cells(row, col).Value = header
		sheet.Columns(col, col + colCount - 1).Width = 120
	End Sub
	Private Sub SubHeaderStyling(sheet As SheetView, row As Integer, col As Integer, rowCount As Integer, colCount As Integer, ParamArray colsWithValidation As Integer())
		sheet.Cells(row, col, row, col + colCount - 1).BackColor = _subHeaderColor
		sheet.Cells(row, col, row + rowCount - 1, col + colCount - 1).Border = New LineBorder(System.Drawing.Color.Black)
        For Each c As Integer In colsWithValidation
            sheet.Cells(row + 1, c, row + rowCount - 1, c).BackColor = _validationColor
        Next
    End Sub

	Private Sub _bAddValidation_Click(sender As Object, e As EventArgs)
		fpSpread.ShowDataValidationForm(Me.ParentForm, True)
	End Sub

	Private Sub _bClearValidation_Click(sender As Object, e As EventArgs)
        Dim cellRange As FarPoint.Win.Spread.Model.CellRange = _sheetIntro.GetSelection(0)
        _sheetIntro.Validations.Clear(cellRange.Row, cellRange.Column, cellRange.Row + cellRange.RowCount - 1, cellRange.Column + cellRange.ColumnCount - 1)
		_sheetIntro.Validations.ClearCircles()
		_sheetIntro.Validations.CircleInvalid()
	End Sub

	Private Sub _bClearAllValidations_Click(sender As Object, e As EventArgs)
		_sheetIntro.Validations.Clear()
		_sheetIntro.Validations.ClearCircles()
	End Sub

	Private Sub _bCircleInvalid_Click(sender As Object, e As EventArgs)
		_sheetIntro.Validations.CircleInvalid()
	End Sub

	Private Sub _bRemoveCircles_Click(sender As Object, e As EventArgs)
		_sheetIntro.Validations.ClearCircles()
	End Sub

	Private Sub AddValidationActions(row As Integer, col As Integer, rowCount As Integer, colCount As Integer, Optional showErr As Boolean = False, Optional errTitle As String = "", _
		Optional errMsg As String = "", Optional showInput As Boolean = False, Optional inputTitle As String = "", Optional inputMsg As String = "")
		Dim row2 As Integer = row + rowCount - 1
		Dim col2 As Integer = col + colCount - 1
		If showErr Then
			_sheetIntro.Cells(row, col, row2, col2).Validation.ShowError = True
			If String.Empty <> errTitle Then
				_sheetIntro.Cells(row, col, row2, col2).Validation.ErrorTitle = errTitle
			End If
			If String.Empty <> errMsg Then
				_sheetIntro.Cells(row, col, row2, col2).Validation.ErrorMessage = errMsg
			End If
		End If
		If showInput Then
			_sheetIntro.Cells(row, col, row2, col2).Validation.ShowInput = True
			If String.Empty <> inputTitle Then
				_sheetIntro.Cells(row, col, row2, col2).Validation.InputTitle = inputTitle
			End If
			If String.Empty <> inputMsg Then
				_sheetIntro.Cells(row, col, row2, col2).Validation.InputMessage = inputMsg
			End If
		End If
	End Sub
	Private Shared Function InlineAssignHelper(Of T)(ByRef target As T, value As T) As T
		target = value
		Return value
	End Function
End Class

'
'
'

Partial Class DataValidation
	''' <summary> 
	''' Required designer variable.
	''' </summary>
	Private components As System.ComponentModel.IContainer = Nothing

    ''' <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

#Region "Component Designer generated code"

    ''' <summary> 
    ''' Required method for Designer support - do not modify 
    ''' the contents of this method with the code editor.
    ''' </summary>
    Private Sub InitializeComponent()
		Me.fpSpread = New FarPoint.Win.Spread.FpSpread()
		Me._sheetIntro = New FarPoint.Win.Spread.SheetView()
		Me._sheetOrderForm = New FarPoint.Win.Spread.SheetView()
		Me._sheetProducts = New FarPoint.Win.Spread.SheetView()
		Me._bAddValidation = New System.Windows.Forms.Button()
		Me._bClearValidation = New System.Windows.Forms.Button()
		Me._bClearAllValidations = New System.Windows.Forms.Button()
		Me._bCircleInvalid = New System.Windows.Forms.Button()
		Me._bRemoveCircles = New System.Windows.Forms.Button()
		Me.pnlMain.SuspendLayout()
		Me.pnlControls.SuspendLayout()
		DirectCast(Me.fpSpread, System.ComponentModel.ISupportInitialize).BeginInit()
		DirectCast(Me._sheetIntro, System.ComponentModel.ISupportInitialize).BeginInit()
		DirectCast(Me._sheetOrderForm, System.ComponentModel.ISupportInitialize).BeginInit()
		DirectCast(Me._sheetProducts, System.ComponentModel.ISupportInitialize).BeginInit()
		Me.SuspendLayout()
		' 
		' pnlMain
		' 
		Me.pnlMain.Controls.Add(Me.fpSpread)
		Me.pnlMain.Size = New System.Drawing.Size(568, 599)
		' 
		' pnlControls
		' 
		Me.pnlControls.Controls.Add(Me._bRemoveCircles)
		Me.pnlControls.Controls.Add(Me._bCircleInvalid)
		Me.pnlControls.Controls.Add(Me._bClearAllValidations)
		Me.pnlControls.Controls.Add(Me._bClearValidation)
		Me.pnlControls.Controls.Add(Me._bAddValidation)
		Me.pnlControls.Size = New System.Drawing.Size(188, 599)
		' 
		' fpSpread
		' 
		Me.fpSpread.Dock = System.Windows.Forms.DockStyle.Fill
		Me.fpSpread.Location = New System.Drawing.Point(0, 0)
		Me.fpSpread.Name = "fpSpread"
		Me.fpSpread.Sheets.AddRange(New FarPoint.Win.Spread.SheetView() {Me._sheetIntro, Me._sheetOrderForm, Me._sheetProducts})
		Me.fpSpread.Size = New System.Drawing.Size(568, 599)
		Me.fpSpread.TabIndex = 0
		' 
		' _sheetIntro
		' 
		Me._sheetIntro.Reset()
		Me._sheetIntro.SheetName = "Introduction"
		' Formulas and custom names must be loaded with R1C1 reference style
		Me._sheetIntro.ReferenceStyle = FarPoint.Win.Spread.Model.ReferenceStyle.R1C1
		Me._sheetIntro.RowHeader.Columns.[Default].Resizable = False
		Me._sheetIntro.ReferenceStyle = FarPoint.Win.Spread.Model.ReferenceStyle.A1
		' 
		' _sheetOrderForm
		' 
		Me._sheetOrderForm.Reset()
		Me._sheetOrderForm.SheetName = "Sample DataValidation"
		' Formulas and custom names must be loaded with R1C1 reference style
		Me._sheetOrderForm.ReferenceStyle = FarPoint.Win.Spread.Model.ReferenceStyle.R1C1
		Me._sheetOrderForm.Cells.[Get](1, 1).Locked = False
		Me._sheetOrderForm.Cells.[Get](1, 2).Locked = False
		Me._sheetOrderForm.Cells.[Get](1, 3).Locked = False
		Me._sheetOrderForm.Cells.[Get](1, 4).Locked = False
		Me._sheetOrderForm.Cells.[Get](1, 5).Locked = False
		Me._sheetOrderForm.Cells.[Get](1, 6).Locked = False
		Me._sheetOrderForm.Cells.[Get](1, 7).Locked = False
		Me._sheetOrderForm.Cells.[Get](2, 1).Locked = False
		Me._sheetOrderForm.Cells.[Get](2, 2).Locked = False
		Me._sheetOrderForm.Cells.[Get](2, 3).Locked = False
		Me._sheetOrderForm.Cells.[Get](2, 4).Locked = False
		Me._sheetOrderForm.Cells.[Get](2, 5).Locked = False
		Me._sheetOrderForm.Cells.[Get](2, 6).Locked = False
		Me._sheetOrderForm.Cells.[Get](2, 7).Locked = False
		Me._sheetOrderForm.Cells.[Get](3, 1).Locked = False
		Me._sheetOrderForm.Cells.[Get](3, 2).Locked = False
		Me._sheetOrderForm.Cells.[Get](3, 3).Locked = False
		Me._sheetOrderForm.Cells.[Get](3, 4).Locked = False
		Me._sheetOrderForm.Cells.[Get](3, 5).Locked = False
		Me._sheetOrderForm.Cells.[Get](3, 6).Locked = False
		Me._sheetOrderForm.Cells.[Get](3, 7).Locked = False
		Me._sheetOrderForm.Cells.[Get](4, 1).Locked = False
		Me._sheetOrderForm.Cells.[Get](4, 2).Locked = False
		Me._sheetOrderForm.Cells.[Get](4, 3).Locked = False
		Me._sheetOrderForm.Cells.[Get](4, 4).Locked = False
		Me._sheetOrderForm.Cells.[Get](4, 5).Locked = False
		Me._sheetOrderForm.Cells.[Get](4, 6).Locked = False
		Me._sheetOrderForm.Cells.[Get](4, 7).Locked = False
		Me._sheetOrderForm.Cells.[Get](5, 1).Locked = False
		Me._sheetOrderForm.Cells.[Get](5, 2).Locked = False
		Me._sheetOrderForm.Cells.[Get](5, 3).Locked = False
		Me._sheetOrderForm.Cells.[Get](5, 4).Locked = False
		Me._sheetOrderForm.Cells.[Get](5, 5).Locked = False
		Me._sheetOrderForm.Cells.[Get](5, 6).Locked = False
		Me._sheetOrderForm.Cells.[Get](5, 7).Locked = False
		Me._sheetOrderForm.Cells.[Get](6, 1).Locked = False
		Me._sheetOrderForm.Cells.[Get](6, 2).Locked = False
		Me._sheetOrderForm.Cells.[Get](6, 3).Locked = False
		Me._sheetOrderForm.Cells.[Get](6, 4).Locked = False
		Me._sheetOrderForm.Cells.[Get](6, 5).Locked = False
		Me._sheetOrderForm.Cells.[Get](6, 6).Locked = False
		Me._sheetOrderForm.Cells.[Get](6, 7).Locked = False
		Me._sheetOrderForm.Cells.[Get](7, 1).Locked = False
		Me._sheetOrderForm.Cells.[Get](7, 2).Locked = False
		Me._sheetOrderForm.Cells.[Get](7, 3).Locked = False
		Me._sheetOrderForm.Cells.[Get](7, 4).Locked = False
		Me._sheetOrderForm.Cells.[Get](7, 5).Locked = False
		Me._sheetOrderForm.Cells.[Get](7, 6).Locked = False
		Me._sheetOrderForm.Cells.[Get](7, 7).Locked = False
		Me._sheetOrderForm.Cells.[Get](8, 1).Locked = False
		Me._sheetOrderForm.Cells.[Get](8, 2).Locked = False
		Me._sheetOrderForm.Cells.[Get](8, 3).Locked = False
		Me._sheetOrderForm.Cells.[Get](8, 4).Locked = False
		Me._sheetOrderForm.Cells.[Get](8, 5).Locked = False
		Me._sheetOrderForm.Cells.[Get](8, 6).Locked = False
		Me._sheetOrderForm.Cells.[Get](8, 7).Locked = False
		Me._sheetOrderForm.Cells.[Get](9, 1).Locked = False
		Me._sheetOrderForm.Cells.[Get](9, 2).Locked = False
		Me._sheetOrderForm.Cells.[Get](9, 3).Locked = False
		Me._sheetOrderForm.Cells.[Get](9, 4).Locked = False
		Me._sheetOrderForm.Cells.[Get](9, 5).Locked = False
		Me._sheetOrderForm.Cells.[Get](9, 6).Locked = False
		Me._sheetOrderForm.Cells.[Get](9, 7).Locked = False
		Me._sheetOrderForm.Cells.[Get](10, 1).Locked = False
		Me._sheetOrderForm.Cells.[Get](10, 2).Locked = False
		Me._sheetOrderForm.Cells.[Get](10, 3).Locked = False
		Me._sheetOrderForm.Cells.[Get](10, 4).Locked = False
		Me._sheetOrderForm.Cells.[Get](10, 5).Locked = False
		Me._sheetOrderForm.Cells.[Get](10, 6).Locked = False
		Me._sheetOrderForm.Cells.[Get](10, 7).Locked = False
		Me._sheetOrderForm.Cells.[Get](11, 1).Locked = False
		Me._sheetOrderForm.Cells.[Get](11, 2).Locked = False
		Me._sheetOrderForm.Cells.[Get](11, 3).Locked = False
		Me._sheetOrderForm.Cells.[Get](11, 4).Locked = False
		Me._sheetOrderForm.Cells.[Get](11, 5).Locked = False
		Me._sheetOrderForm.Cells.[Get](11, 6).Locked = False
		Me._sheetOrderForm.Cells.[Get](11, 7).Locked = False
		Me._sheetOrderForm.Cells.[Get](12, 1).Locked = False
		Me._sheetOrderForm.Cells.[Get](12, 2).Locked = False
		Me._sheetOrderForm.Cells.[Get](12, 3).Locked = False
		Me._sheetOrderForm.Cells.[Get](12, 4).Locked = False
		Me._sheetOrderForm.Cells.[Get](12, 5).Locked = False
		Me._sheetOrderForm.Cells.[Get](12, 6).Locked = False
		Me._sheetOrderForm.Cells.[Get](12, 7).Locked = False
		Me._sheetOrderForm.Cells.[Get](13, 1).Locked = False
		Me._sheetOrderForm.Cells.[Get](13, 2).Locked = False
		Me._sheetOrderForm.Cells.[Get](13, 3).Locked = False
		Me._sheetOrderForm.Cells.[Get](13, 4).Locked = False
		Me._sheetOrderForm.Cells.[Get](13, 5).Locked = False
		Me._sheetOrderForm.Cells.[Get](13, 6).Locked = False
		Me._sheetOrderForm.Cells.[Get](13, 7).Locked = False
		Me._sheetOrderForm.Cells.[Get](14, 1).Locked = False
		Me._sheetOrderForm.Cells.[Get](14, 2).Locked = False
		Me._sheetOrderForm.Cells.[Get](14, 3).Locked = False
		Me._sheetOrderForm.Cells.[Get](14, 4).Locked = False
		Me._sheetOrderForm.Cells.[Get](14, 5).Locked = False
		Me._sheetOrderForm.Cells.[Get](14, 6).Locked = False
		Me._sheetOrderForm.Cells.[Get](14, 7).Locked = False
		Me._sheetOrderForm.ReferenceStyle = FarPoint.Win.Spread.Model.ReferenceStyle.A1
		' 
		' _sheetProducts
		' 
		Me._sheetProducts.Reset()
		Me._sheetProducts.SheetName = "Products"
		' Formulas and custom names must be loaded with R1C1 reference style
		Me._sheetProducts.ReferenceStyle = FarPoint.Win.Spread.Model.ReferenceStyle.R1C1
		Me._sheetProducts.ReferenceStyle = FarPoint.Win.Spread.Model.ReferenceStyle.A1
		' 
		' _bAddValidation
		' 
		Me._bAddValidation.Anchor = CType(((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Left) Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
		Me._bAddValidation.Location = New System.Drawing.Point(15, 19)
		Me._bAddValidation.Name = "_bAddValidation"
		Me._bAddValidation.Size = New System.Drawing.Size(121, 23)
		Me._bAddValidation.TabIndex = 0
		Me._bAddValidation.Text = "Add Validation To Cells"
		Me._bAddValidation.UseVisualStyleBackColor = True
		AddHandler Me._bAddValidation.Click, New System.EventHandler(AddressOf Me._bAddValidation_Click)
		' 
		' _bClearValidation
		' 
		Me._bClearValidation.Anchor = CType(((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Left) Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
		Me._bClearValidation.Location = New System.Drawing.Point(15, 48)
		Me._bClearValidation.Name = "_bClearValidation"
		Me._bClearValidation.Size = New System.Drawing.Size(121, 23)
		Me._bClearValidation.TabIndex = 1
		Me._bClearValidation.Text = "Clear Validation From Cells"
		Me._bClearValidation.UseVisualStyleBackColor = True
		AddHandler Me._bClearValidation.Click, New System.EventHandler(AddressOf Me._bClearValidation_Click)
		' 
		' _bClearAllValidations
		' 
		Me._bClearAllValidations.Anchor = CType(((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Left) Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
		Me._bClearAllValidations.Location = New System.Drawing.Point(15, 77)
		Me._bClearAllValidations.Name = "_bClearAllValidations"
		Me._bClearAllValidations.Size = New System.Drawing.Size(121, 23)
		Me._bClearAllValidations.TabIndex = 2
		Me._bClearAllValidations.Text = "Clear All Validations"
		Me._bClearAllValidations.UseVisualStyleBackColor = True
		AddHandler Me._bClearAllValidations.Click, New System.EventHandler(AddressOf Me._bClearAllValidations_Click)
		' 
		' _bCircleInvalid
		' 
		Me._bCircleInvalid.Anchor = CType(((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Left) Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
		Me._bCircleInvalid.Location = New System.Drawing.Point(15, 139)
		Me._bCircleInvalid.Name = "_bCircleInvalid"
		Me._bCircleInvalid.Size = New System.Drawing.Size(121, 23)
		Me._bCircleInvalid.TabIndex = 3
		Me._bCircleInvalid.Text = "Circle Invalid Cells"
		Me._bCircleInvalid.UseVisualStyleBackColor = True
		AddHandler Me._bCircleInvalid.Click, New System.EventHandler(AddressOf Me._bCircleInvalid_Click)
		' 
		' _bRemoveCircles
		' 
		Me._bRemoveCircles.Anchor = CType(((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Left) Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
		Me._bRemoveCircles.Location = New System.Drawing.Point(16, 168)
		Me._bRemoveCircles.Name = "_bRemoveCircles"
		Me._bRemoveCircles.Size = New System.Drawing.Size(120, 23)
		Me._bRemoveCircles.TabIndex = 4
		Me._bRemoveCircles.Text = "Remove Circles"
		Me._bRemoveCircles.UseVisualStyleBackColor = True
		AddHandler Me._bRemoveCircles.Click, New System.EventHandler(AddressOf Me._bRemoveCircles_Click)
		' 
		' DataValidation
		' 
		Me.AutoScaleDimensions = New System.Drawing.SizeF(6F, 13F)
		Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
		Me.Name = "DataValidation"
		Me.Size = New System.Drawing.Size(757, 599)
		Me.pnlMain.ResumeLayout(False)
		Me.pnlControls.ResumeLayout(False)
		DirectCast(Me.fpSpread, System.ComponentModel.ISupportInitialize).EndInit()
		DirectCast(Me._sheetIntro, System.ComponentModel.ISupportInitialize).EndInit()
		DirectCast(Me._sheetOrderForm, System.ComponentModel.ISupportInitialize).EndInit()
		DirectCast(Me._sheetProducts, System.ComponentModel.ISupportInitialize).EndInit()
		Me.ResumeLayout(False)

	End Sub

	#End Region

	Private fpSpread As FarPoint.Win.Spread.FpSpread
	Private _sheetProducts As FarPoint.Win.Spread.SheetView
	Private _sheetOrderForm As FarPoint.Win.Spread.SheetView
	Private _sheetIntro As FarPoint.Win.Spread.SheetView
	Private _bRemoveCircles As System.Windows.Forms.Button
	Private _bCircleInvalid As System.Windows.Forms.Button
	Private _bClearAllValidations As System.Windows.Forms.Button
	Private _bClearValidation As System.Windows.Forms.Button
	Private _bAddValidation As System.Windows.Forms.Button
End Class
