Hello everyone, I have connected a form to my database, which displays info when the form loads, butttt it displays them from load, which is not what I need, can someone tell me how to clear the form upon load so that none of the textbox fierlds have data within them? Untill I request them to.

Hope someone can help

Ram

>can someone tell me how to clear the form upon load so that none of the textbox fierlds have data within them?

I'm not quite following the problem. If you don't want to display data on form load then remove that particular code.

What does this code consists off so I can try and get rid of it.


The first row is displayed within the text box upon load.

'-------------------------------------------------------------------------------
'GrFinger Sample
'(c) 2005 - 2010 Griaule Biometrics Ltda.
'http://www.griaulebiometrics.com
'-------------------------------------------------------------------------------
'
'This sample is provided with "GrFinger Fingerprint Recognition Library" and
'can't run without it. It's provided just as an example of using GrFinger
'Fingerprint Recognition Library and should not be used as basis for any
'commercial product.
'
'Griaule Biometrics makes no representations concerning either the merchantability
'of this software or the suitability of this sample for any particular purpose.
'
'THIS SAMPLE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR
'IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
'OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
'IN NO EVENT SHALL GRIAULE BE LIABLE FOR ANY DIRECT, INDIRECT,
'INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
'NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
'DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
'THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
'(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
'THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
'
'You can download the trial version of GrFinger directly from Griaule website.
'
'These notices must be retained in any copies of any part of this
'documentation and/or sample.
'
'-------------------------------------------------------------------------------

' -----------------------------------------------------------------------------------
' GUI routines: main form
' -----------------------------------------------------------------------------------

Imports GrFingerXLib
Imports Microsoft.VisualBasic

Public Class MainForm
    Inherits System.Windows.Forms.Form

#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 PictureBox1 As System.Windows.Forms.PictureBox
    Friend WithEvents MainMenu1 As System.Windows.Forms.MainMenu
    Friend WithEvents MenuItem1 As System.Windows.Forms.MenuItem
    Friend WithEvents AxGrFingerXCtrl1 As AxGrFingerXLib.AxGrFingerXCtrl
    Friend WithEvents LogList As System.Windows.Forms.ListBox
    Friend WithEvents ClearLogButton As System.Windows.Forms.Button
    Friend WithEvents ExtractButton As System.Windows.Forms.Button
    Friend WithEvents ckAutoExtract As System.Windows.Forms.CheckBox
    Friend WithEvents IdentifyButton As System.Windows.Forms.Button
    Friend WithEvents ckBoxAutoIdentify As System.Windows.Forms.CheckBox
    Friend WithEvents EnrollButton As System.Windows.Forms.Button
    Friend WithEvents VerifyButton As System.Windows.Forms.Button
    Friend WithEvents ClearDatabaseButton As System.Windows.Forms.Button
    Friend WithEvents MenuSave As System.Windows.Forms.MenuItem
    Friend WithEvents MenuLoad As System.Windows.Forms.MenuItem
    Friend WithEvents MenuOptions As System.Windows.Forms.MenuItem
    Friend WithEvents Patients1DataSet As GrFingerXSampleVB.NET2005.Patients1DataSet
    Friend WithEvents PatientsBindingSource As System.Windows.Forms.BindingSource
    Friend WithEvents PatientsTableAdapter As GrFingerXSampleVB.NET2005.Patients1DataSetTableAdapters.PatientsTableAdapter
    Friend WithEvents TableAdapterManager As GrFingerXSampleVB.NET2005.Patients1DataSetTableAdapters.TableAdapterManager
    Friend WithEvents PatientsBindingNavigator As System.Windows.Forms.BindingNavigator
    Friend WithEvents BindingNavigatorAddNewItem As System.Windows.Forms.ToolStripButton
    Friend WithEvents BindingNavigatorDeleteItem As System.Windows.Forms.ToolStripButton
    Friend WithEvents BindingNavigatorMoveNextItem As System.Windows.Forms.ToolStripButton
    Friend WithEvents BindingNavigatorMoveLastItem As System.Windows.Forms.ToolStripButton
    Friend WithEvents BindingNavigatorSeparator2 As System.Windows.Forms.ToolStripSeparator
    Friend WithEvents PatientsBindingNavigatorSaveItem As System.Windows.Forms.ToolStripButton
    Friend WithEvents IDTextBox As System.Windows.Forms.TextBox
    Friend WithEvents NameTextBox As System.Windows.Forms.TextBox
    Friend WithEvents SurnameTextBox As System.Windows.Forms.TextBox
    Friend WithEvents Date_OfBirthTextBox As System.Windows.Forms.TextBox
    Friend WithEvents SexTextBox As System.Windows.Forms.TextBox
    Friend WithEvents Blood_TypeTextBox As System.Windows.Forms.TextBox
    Friend WithEvents AllergiesTextBox As System.Windows.Forms.TextBox
    Friend WithEvents Address_1TextBox As System.Windows.Forms.TextBox
    Friend WithEvents TownTextBox As System.Windows.Forms.TextBox
    Friend WithEvents PostcodeTextBox As System.Windows.Forms.TextBox
    Friend WithEvents Next_Of_KinTextBox As System.Windows.Forms.TextBox
    Friend WithEvents Next_Of_Kin_NumberTextBox As System.Windows.Forms.TextBox
    Friend WithEvents BindingNavigatorCountItem As System.Windows.Forms.ToolStripLabel
    Friend WithEvents BindingNavigatorMoveFirstItem As System.Windows.Forms.ToolStripButton
    Friend WithEvents BindingNavigatorMovePreviousItem As System.Windows.Forms.ToolStripButton
    Friend WithEvents BindingNavigatorSeparator As System.Windows.Forms.ToolStripSeparator
    Friend WithEvents BindingNavigatorPositionItem As System.Windows.Forms.ToolStripTextBox
    Friend WithEvents BindingNavigatorSeparator1 As System.Windows.Forms.ToolStripSeparator
    Friend WithEvents MenuVersion As System.Windows.Forms.MenuItem
    <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
        Me.components = New System.ComponentModel.Container
        Dim IDLabel As System.Windows.Forms.Label
        Dim NameLabel As System.Windows.Forms.Label
        Dim SurnameLabel As System.Windows.Forms.Label
        Dim Date_OfBirthLabel As System.Windows.Forms.Label
        Dim SexLabel As System.Windows.Forms.Label
        Dim Blood_TypeLabel As System.Windows.Forms.Label
        Dim AllergiesLabel As System.Windows.Forms.Label
        Dim Address_1Label As System.Windows.Forms.Label
        Dim TownLabel As System.Windows.Forms.Label
        Dim PostcodeLabel As System.Windows.Forms.Label
        Dim Next_Of_KinLabel As System.Windows.Forms.Label
        Dim Next_Of_Kin_NumberLabel As System.Windows.Forms.Label
        Dim resources As System.ComponentModel.ComponentResourceManager = New System.ComponentModel.ComponentResourceManager(GetType(MainForm))
        Me.PictureBox1 = New System.Windows.Forms.PictureBox
        Me.MainMenu1 = New System.Windows.Forms.MainMenu(Me.components)
        Me.MenuItem1 = New System.Windows.Forms.MenuItem
        Me.MenuSave = New System.Windows.Forms.MenuItem
        Me.MenuLoad = New System.Windows.Forms.MenuItem
        Me.MenuOptions = New System.Windows.Forms.MenuItem
        Me.MenuVersion = New System.Windows.Forms.MenuItem
        Me.EnrollButton = New System.Windows.Forms.Button
        Me.VerifyButton = New System.Windows.Forms.Button
        Me.IdentifyButton = New System.Windows.Forms.Button
        Me.ClearDatabaseButton = New System.Windows.Forms.Button
        Me.ClearLogButton = New System.Windows.Forms.Button
        Me.ckBoxAutoIdentify = New System.Windows.Forms.CheckBox
        Me.LogList = New System.Windows.Forms.ListBox
        Me.AxGrFingerXCtrl1 = New AxGrFingerXLib.AxGrFingerXCtrl
        Me.ExtractButton = New System.Windows.Forms.Button
        Me.ckAutoExtract = New System.Windows.Forms.CheckBox
        Me.Patients1DataSet = New GrFingerXSampleVB.NET2005.Patients1DataSet
        Me.PatientsBindingSource = New System.Windows.Forms.BindingSource(Me.components)
        Me.PatientsTableAdapter = New GrFingerXSampleVB.NET2005.Patients1DataSetTableAdapters.PatientsTableAdapter
        Me.TableAdapterManager = New GrFingerXSampleVB.NET2005.Patients1DataSetTableAdapters.TableAdapterManager
        Me.PatientsBindingNavigator = New System.Windows.Forms.BindingNavigator(Me.components)
        Me.BindingNavigatorAddNewItem = New System.Windows.Forms.ToolStripButton
        Me.BindingNavigatorCountItem = New System.Windows.Forms.ToolStripLabel
        Me.BindingNavigatorDeleteItem = New System.Windows.Forms.ToolStripButton
        Me.BindingNavigatorMoveFirstItem = New System.Windows.Forms.ToolStripButton
        Me.BindingNavigatorMovePreviousItem = New System.Windows.Forms.ToolStripButton
        Me.BindingNavigatorSeparator = New System.Windows.Forms.ToolStripSeparator
        Me.BindingNavigatorPositionItem = New System.Windows.Forms.ToolStripTextBox
        Me.BindingNavigatorSeparator1 = New System.Windows.Forms.ToolStripSeparator
        Me.BindingNavigatorMoveNextItem = New System.Windows.Forms.ToolStripButton
        Me.BindingNavigatorMoveLastItem = New System.Windows.Forms.ToolStripButton
        Me.BindingNavigatorSeparator2 = New System.Windows.Forms.ToolStripSeparator
        Me.PatientsBindingNavigatorSaveItem = New System.Windows.Forms.ToolStripButton
        Me.IDTextBox = New System.Windows.Forms.TextBox
        Me.NameTextBox = New System.Windows.Forms.TextBox
        Me.SurnameTextBox = New System.Windows.Forms.TextBox
        Me.Date_OfBirthTextBox = New System.Windows.Forms.TextBox
        Me.SexTextBox = New System.Windows.Forms.TextBox
        Me.Blood_TypeTextBox = New System.Windows.Forms.TextBox
        Me.AllergiesTextBox = New System.Windows.Forms.TextBox
        Me.Address_1TextBox = New System.Windows.Forms.TextBox
        Me.TownTextBox = New System.Windows.Forms.TextBox
        Me.PostcodeTextBox = New System.Windows.Forms.TextBox
        Me.Next_Of_KinTextBox = New System.Windows.Forms.TextBox
        Me.Next_Of_Kin_NumberTextBox = New System.Windows.Forms.TextBox
        IDLabel = New System.Windows.Forms.Label
        NameLabel = New System.Windows.Forms.Label
        SurnameLabel = New System.Windows.Forms.Label
        Date_OfBirthLabel = New System.Windows.Forms.Label
        SexLabel = New System.Windows.Forms.Label
        Blood_TypeLabel = New System.Windows.Forms.Label
        AllergiesLabel = New System.Windows.Forms.Label
        Address_1Label = New System.Windows.Forms.Label
        TownLabel = New System.Windows.Forms.Label
        PostcodeLabel = New System.Windows.Forms.Label
        Next_Of_KinLabel = New System.Windows.Forms.Label
        Next_Of_Kin_NumberLabel = New System.Windows.Forms.Label
        CType(Me.PictureBox1, System.ComponentModel.ISupportInitialize).BeginInit()
        CType(Me.AxGrFingerXCtrl1, System.ComponentModel.ISupportInitialize).BeginInit()
        CType(Me.Patients1DataSet, System.ComponentModel.ISupportInitialize).BeginInit()
        CType(Me.PatientsBindingSource, System.ComponentModel.ISupportInitialize).BeginInit()
        CType(Me.PatientsBindingNavigator, System.ComponentModel.ISupportInitialize).BeginInit()
        Me.PatientsBindingNavigator.SuspendLayout()
        Me.SuspendLayout()
        '
        'IDLabel
        '
        IDLabel.AutoSize = True
        IDLabel.Location = New System.Drawing.Point(58, 78)
        IDLabel.Name = "IDLabel"
        IDLabel.Size = New System.Drawing.Size(21, 13)
        IDLabel.TabIndex = 12
        IDLabel.Text = "ID:"
        '
        'NameLabel
        '
        NameLabel.AutoSize = True
        NameLabel.Location = New System.Drawing.Point(41, 104)
        NameLabel.Name = "NameLabel"
        NameLabel.Size = New System.Drawing.Size(38, 13)
        NameLabel.TabIndex = 14
        NameLabel.Text = "Name:"
        '
        'SurnameLabel
        '
        SurnameLabel.AutoSize = True
        SurnameLabel.Location = New System.Drawing.Point(27, 130)
        SurnameLabel.Name = "SurnameLabel"
        SurnameLabel.Size = New System.Drawing.Size(52, 13)
        SurnameLabel.TabIndex = 16
        SurnameLabel.Text = "Surname:"
        '
        'Date_OfBirthLabel
        '
        Date_OfBirthLabel.AutoSize = True
        Date_OfBirthLabel.Location = New System.Drawing.Point(8, 156)
        Date_OfBirthLabel.Name = "Date_OfBirthLabel"
        Date_OfBirthLabel.Size = New System.Drawing.Size(71, 13)
        Date_OfBirthLabel.TabIndex = 18
        Date_OfBirthLabel.Text = "Date Of Birth:"
        '
        'SexLabel
        '
        SexLabel.AutoSize = True
        SexLabel.Location = New System.Drawing.Point(51, 182)
        SexLabel.Name = "SexLabel"
        SexLabel.Size = New System.Drawing.Size(28, 13)
        SexLabel.TabIndex = 20
        SexLabel.Text = "Sex:"
        '
        'Blood_TypeLabel
        '
        Blood_TypeLabel.AutoSize = True
        Blood_TypeLabel.Location = New System.Drawing.Point(15, 208)
        Blood_TypeLabel.Name = "Blood_TypeLabel"
        Blood_TypeLabel.Size = New System.Drawing.Size(64, 13)
        Blood_TypeLabel.TabIndex = 22
        Blood_TypeLabel.Text = "Blood Type:"
        '
        'AllergiesLabel
        '
        AllergiesLabel.AutoSize = True
        AllergiesLabel.Location = New System.Drawing.Point(30, 234)
        AllergiesLabel.Name = "AllergiesLabel"
        AllergiesLabel.Size = New System.Drawing.Size(49, 13)
        AllergiesLabel.TabIndex = 24
        AllergiesLabel.Text = "Allergies:"
        '
        'Address_1Label
        '
        Address_1Label.AutoSize = True
        Address_1Label.Location = New System.Drawing.Point(223, 75)
        Address_1Label.Name = "Address_1Label"
        Address_1Label.Size = New System.Drawing.Size(57, 13)
        Address_1Label.TabIndex = 26
        Address_1Label.Text = "Address 1:"
        '
        'TownLabel
        '
        TownLabel.AutoSize = True
        TownLabel.Location = New System.Drawing.Point(233, 101)
        TownLabel.Name = "TownLabel"
        TownLabel.Size = New System.Drawing.Size(37, 13)
        TownLabel.TabIndex = 28
        TownLabel.Text = "Town:"
        '
        'PostcodeLabel
        '
        PostcodeLabel.AutoSize = True
        PostcodeLabel.Location = New System.Drawing.Point(225, 127)
        PostcodeLabel.Name = "PostcodeLabel"
        PostcodeLabel.Size = New System.Drawing.Size(55, 13)
        PostcodeLabel.TabIndex = 30
        PostcodeLabel.Text = "Postcode:"
        '
        'Next_Of_KinLabel
        '
        Next_Of_KinLabel.AutoSize = True
        Next_Of_KinLabel.Location = New System.Drawing.Point(448, 72)
        Next_Of_KinLabel.Name = "Next_Of_KinLabel"
        Next_Of_KinLabel.Size = New System.Drawing.Size(64, 13)
        Next_Of_KinLabel.TabIndex = 32
        Next_Of_KinLabel.Text = "Next Of Kin:"
        '
        'Next_Of_Kin_NumberLabel
        '
        Next_Of_Kin_NumberLabel.AutoSize = True
        Next_Of_Kin_NumberLabel.Location = New System.Drawing.Point(408, 98)
        Next_Of_Kin_NumberLabel.Name = "Next_Of_Kin_NumberLabel"
        Next_Of_Kin_NumberLabel.Size = New System.Drawing.Size(104, 13)
        Next_Of_Kin_NumberLabel.TabIndex = 34
        Next_Of_Kin_NumberLabel.Text = "Next Of Kin Number:"
        '
        'PictureBox1
        '
        Me.PictureBox1.BackColor = System.Drawing.SystemColors.Control
        Me.PictureBox1.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D
        Me.PictureBox1.Location = New System.Drawing.Point(680, 41)
        Me.PictureBox1.Name = "PictureBox1"
        Me.PictureBox1.Size = New System.Drawing.Size(132, 180)
        Me.PictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage
        Me.PictureBox1.TabIndex = 0
        Me.PictureBox1.TabStop = False
        '
        'MainMenu1
        '
        Me.MainMenu1.MenuItems.AddRange(New System.Windows.Forms.MenuItem() {Me.MenuItem1, Me.MenuOptions, Me.MenuVersion})
        '
        'MenuItem1
        '
        Me.MenuItem1.Index = 0
        Me.MenuItem1.MenuItems.AddRange(New System.Windows.Forms.MenuItem() {Me.MenuSave, Me.MenuLoad})
        Me.MenuItem1.Text = "&Image"
        '
        'MenuSave
        '
        Me.MenuSave.Index = 0
        Me.MenuSave.Shortcut = System.Windows.Forms.Shortcut.CtrlS
        Me.MenuSave.Text = "Save..."
        '
        'MenuLoad
        '
        Me.MenuLoad.Index = 1
        Me.MenuLoad.Shortcut = System.Windows.Forms.Shortcut.CtrlL
        Me.MenuLoad.Text = "Load From File..."
        '
        'MenuOptions
        '
        Me.MenuOptions.Index = 1
        Me.MenuOptions.Text = "&Options..."
        '
        'MenuVersion
        '
        Me.MenuVersion.Index = 2
        Me.MenuVersion.Text = "&Version"
        '
        'EnrollButton
        '
        Me.EnrollButton.Enabled = False
        Me.EnrollButton.Location = New System.Drawing.Point(818, 145)
        Me.EnrollButton.Name = "EnrollButton"
        Me.EnrollButton.Size = New System.Drawing.Size(96, 24)
        Me.EnrollButton.TabIndex = 1
        Me.EnrollButton.Text = "Enroll"
        '
        'VerifyButton
        '
        Me.VerifyButton.Enabled = False
        Me.VerifyButton.Location = New System.Drawing.Point(818, 177)
        Me.VerifyButton.Name = "VerifyButton"
        Me.VerifyButton.Size = New System.Drawing.Size(96, 24)
        Me.VerifyButton.TabIndex = 2
        Me.VerifyButton.Text = "Verify"
        '
        'IdentifyButton
        '
        Me.IdentifyButton.Enabled = False
        Me.IdentifyButton.Location = New System.Drawing.Point(818, 209)
        Me.IdentifyButton.Name = "IdentifyButton"
        Me.IdentifyButton.Size = New System.Drawing.Size(96, 24)
        Me.IdentifyButton.TabIndex = 3
        Me.IdentifyButton.Text = "Identify"
        '
        'ClearDatabaseButton
        '
        Me.ClearDatabaseButton.Location = New System.Drawing.Point(818, 289)
        Me.ClearDatabaseButton.Name = "ClearDatabaseButton"
        Me.ClearDatabaseButton.Size = New System.Drawing.Size(96, 24)
        Me.ClearDatabaseButton.TabIndex = 4
        Me.ClearDatabaseButton.Text = "Clear database"
        '
        'ClearLogButton
        '
        Me.ClearLogButton.Location = New System.Drawing.Point(818, 321)
        Me.ClearLogButton.Name = "ClearLogButton"
        Me.ClearLogButton.Size = New System.Drawing.Size(96, 24)
        Me.ClearLogButton.TabIndex = 5
        Me.ClearLogButton.Text = "Clear log"
        '
        'ckBoxAutoIdentify
        '
        Me.ckBoxAutoIdentify.Checked = True
        Me.ckBoxAutoIdentify.CheckState = System.Windows.Forms.CheckState.Checked
        Me.ckBoxAutoIdentify.Location = New System.Drawing.Point(818, 361)
        Me.ckBoxAutoIdentify.Name = "ckBoxAutoIdentify"
        Me.ckBoxAutoIdentify.Size = New System.Drawing.Size(88, 16)
        Me.ckBoxAutoIdentify.TabIndex = 6
        Me.ckBoxAutoIdentify.Text = "Auto identify"
        Me.ckBoxAutoIdentify.Visible = False
        '
        'LogList
        '
        Me.LogList.Location = New System.Drawing.Point(8, 424)
        Me.LogList.Name = "LogList"
        Me.LogList.ScrollAlwaysVisible = True
        Me.LogList.Size = New System.Drawing.Size(504, 108)
        Me.LogList.TabIndex = 7
        '
        'AxGrFingerXCtrl1
        '
        Me.AxGrFingerXCtrl1.Enabled = True
        Me.AxGrFingerXCtrl1.Location = New System.Drawing.Point(858, 41)
        Me.AxGrFingerXCtrl1.Name = "AxGrFingerXCtrl1"
        Me.AxGrFingerXCtrl1.OcxState = CType(resources.GetObject("AxGrFingerXCtrl1.OcxState"), System.Windows.Forms.AxHost.State)
        Me.AxGrFingerXCtrl1.Size = New System.Drawing.Size(32, 32)
        Me.AxGrFingerXCtrl1.TabIndex = 8
        '
        'ExtractButton
        '
        Me.ExtractButton.Enabled = False
        Me.ExtractButton.Location = New System.Drawing.Point(818, 241)
        Me.ExtractButton.Name = "ExtractButton"
        Me.ExtractButton.Size = New System.Drawing.Size(96, 24)
        Me.ExtractButton.TabIndex = 9
        Me.ExtractButton.Text = "Extract template"
        '
        'ckAutoExtract
        '
        Me.ckAutoExtract.Checked = True
        Me.ckAutoExtract.CheckState = System.Windows.Forms.CheckState.Checked
        Me.ckAutoExtract.Location = New System.Drawing.Point(818, 377)
        Me.ckAutoExtract.Name = "ckAutoExtract"
        Me.ckAutoExtract.Size = New System.Drawing.Size(88, 24)
        Me.ckAutoExtract.TabIndex = 10
        Me.ckAutoExtract.Text = "Auto Extract"
        Me.ckAutoExtract.Visible = False
        '
        'Patients1DataSet
        '
        Me.Patients1DataSet.DataSetName = "Patients1DataSet"
        Me.Patients1DataSet.SchemaSerializationMode = System.Data.SchemaSerializationMode.IncludeSchema
        '
        'PatientsBindingSource
        '
        Me.PatientsBindingSource.DataMember = "Patients"
        Me.PatientsBindingSource.DataSource = Me.Patients1DataSet
        '
        'PatientsTableAdapter
        '
        Me.PatientsTableAdapter.ClearBeforeFill = False


        '
        'TableAdapterManager
        '
        Me.TableAdapterManager.BackupDataSetBeforeUpdate = False
        Me.TableAdapterManager.PatientsTableAdapter = Me.PatientsTableAdapter
        Me.TableAdapterManager.UpdateOrder = GrFingerXSampleVB.NET2005.Patients1DataSetTableAdapters.TableAdapterManager.UpdateOrderOption.InsertUpdateDelete


        '
        'PatientsBindingNavigator
        '
        Me.PatientsBindingNavigator.AddNewItem = Me.BindingNavigatorAddNewItem
        Me.PatientsBindingNavigator.BindingSource = Me.PatientsBindingSource
        Me.PatientsBindingNavigator.CountItem = Me.BindingNavigatorCountItem
        Me.PatientsBindingNavigator.DeleteItem = Me.BindingNavigatorDeleteItem
        Me.PatientsBindingNavigator.Items.AddRange(New System.Windows.Forms.ToolStripItem() {Me.BindingNavigatorMoveFirstItem, Me.BindingNavigatorMovePreviousItem, Me.BindingNavigatorSeparator, Me.BindingNavigatorPositionItem, Me.BindingNavigatorCountItem, Me.BindingNavigatorSeparator1, Me.BindingNavigatorMoveNextItem, Me.BindingNavigatorMoveLastItem, Me.BindingNavigatorSeparator2, Me.BindingNavigatorAddNewItem, Me.BindingNavigatorDeleteItem, Me.PatientsBindingNavigatorSaveItem})
        Me.PatientsBindingNavigator.Location = New System.Drawing.Point(0, 0)
        Me.PatientsBindingNavigator.MoveFirstItem = Me.BindingNavigatorMoveFirstItem
        Me.PatientsBindingNavigator.MoveLastItem = Me.BindingNavigatorMoveLastItem
        Me.PatientsBindingNavigator.MoveNextItem = Me.BindingNavigatorMoveNextItem
        Me.PatientsBindingNavigator.MovePreviousItem = Me.BindingNavigatorMovePreviousItem
        Me.PatientsBindingNavigator.Name = "PatientsBindingNavigator"
        Me.PatientsBindingNavigator.PositionItem = Me.BindingNavigatorPositionItem
        Me.PatientsBindingNavigator.Size = New System.Drawing.Size(1028, 25)
        Me.PatientsBindingNavigator.TabIndex = 11
        Me.PatientsBindingNavigator.Text = "BindingNavigator1"
        '
        'BindingNavigatorAddNewItem
        '
        Me.BindingNavigatorAddNewItem.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image
        Me.BindingNavigatorAddNewItem.Image = CType(resources.GetObject("BindingNavigatorAddNewItem.Image"), System.Drawing.Image)
        Me.BindingNavigatorAddNewItem.Name = "BindingNavigatorAddNewItem"
        Me.BindingNavigatorAddNewItem.RightToLeftAutoMirrorImage = True
        Me.BindingNavigatorAddNewItem.Size = New System.Drawing.Size(23, 22)
        Me.BindingNavigatorAddNewItem.Text = "Add new"
        '
        'BindingNavigatorCountItem
        '
        Me.BindingNavigatorCountItem.Name = "BindingNavigatorCountItem"
        Me.BindingNavigatorCountItem.Size = New System.Drawing.Size(36, 22)
        Me.BindingNavigatorCountItem.Text = "of {0}"
        Me.BindingNavigatorCountItem.ToolTipText = "Total number of items"
        '
        'BindingNavigatorDeleteItem
        '
        Me.BindingNavigatorDeleteItem.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image
        Me.BindingNavigatorDeleteItem.Image = CType(resources.GetObject("BindingNavigatorDeleteItem.Image"), System.Drawing.Image)
        Me.BindingNavigatorDeleteItem.Name = "BindingNavigatorDeleteItem"
        Me.BindingNavigatorDeleteItem.RightToLeftAutoMirrorImage = True
        Me.BindingNavigatorDeleteItem.Size = New System.Drawing.Size(23, 22)
        Me.BindingNavigatorDeleteItem.Text = "Delete"
        '
        'BindingNavigatorMoveFirstItem
        '
        Me.BindingNavigatorMoveFirstItem.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image
        Me.BindingNavigatorMoveFirstItem.Image = CType(resources.GetObject("BindingNavigatorMoveFirstItem.Image"), System.Drawing.Image)
        Me.BindingNavigatorMoveFirstItem.Name = "BindingNavigatorMoveFirstItem"
        Me.BindingNavigatorMoveFirstItem.RightToLeftAutoMirrorImage = True
        Me.BindingNavigatorMoveFirstItem.Size = New System.Drawing.Size(23, 22)
        Me.BindingNavigatorMoveFirstItem.Text = "Move first"
        '
        'BindingNavigatorMovePreviousItem
        '
        Me.BindingNavigatorMovePreviousItem.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image
        Me.BindingNavigatorMovePreviousItem.Image = CType(resources.GetObject("BindingNavigatorMovePreviousItem.Image"), System.Drawing.Image)
        Me.BindingNavigatorMovePreviousItem.Name = "BindingNavigatorMovePreviousItem"
        Me.BindingNavigatorMovePreviousItem.RightToLeftAutoMirrorImage = True
        Me.BindingNavigatorMovePreviousItem.Size = New System.Drawing.Size(23, 22)
        Me.BindingNavigatorMovePreviousItem.Text = "Move previous"
        '
        'BindingNavigatorSeparator
        '
        Me.BindingNavigatorSeparator.Name = "BindingNavigatorSeparator"
        Me.BindingNavigatorSeparator.Size = New System.Drawing.Size(6, 25)
        '
        'BindingNavigatorPositionItem
        '
        Me.BindingNavigatorPositionItem.AccessibleName = "Position"
        Me.BindingNavigatorPositionItem.AutoSize = False
        Me.BindingNavigatorPositionItem.Name = "BindingNavigatorPositionItem"
        Me.BindingNavigatorPositionItem.Size = New System.Drawing.Size(50, 23)
        Me.BindingNavigatorPositionItem.Text = "0"
        Me.BindingNavigatorPositionItem.ToolTipText = "Current position"
        '
        'BindingNavigatorSeparator1
        '
        Me.BindingNavigatorSeparator1.Name = "BindingNavigatorSeparator1"
        Me.BindingNavigatorSeparator1.Size = New System.Drawing.Size(6, 25)
        '
        'BindingNavigatorMoveNextItem
        '
        Me.BindingNavigatorMoveNextItem.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image
        Me.BindingNavigatorMoveNextItem.Image = CType(resources.GetObject("BindingNavigatorMoveNextItem.Image"), System.Drawing.Image)
        Me.BindingNavigatorMoveNextItem.Name = "BindingNavigatorMoveNextItem"
        Me.BindingNavigatorMoveNextItem.RightToLeftAutoMirrorImage = True
        Me.BindingNavigatorMoveNextItem.Size = New System.Drawing.Size(23, 22)
        Me.BindingNavigatorMoveNextItem.Text = "Move next"
        '
        'BindingNavigatorMoveLastItem
        '
        Me.BindingNavigatorMoveLastItem.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image
        Me.BindingNavigatorMoveLastItem.Image = CType(resources.GetObject("BindingNavigatorMoveLastItem.Image"), System.Drawing.Image)
        Me.BindingNavigatorMoveLastItem.Name = "BindingNavigatorMoveLastItem"
        Me.BindingNavigatorMoveLastItem.RightToLeftAutoMirrorImage = True
        Me.BindingNavigatorMoveLastItem.Size = New System.Drawing.Size(23, 22)
        Me.BindingNavigatorMoveLastItem.Text = "Move last"
        '
        'BindingNavigatorSeparator2
        '
        Me.BindingNavigatorSeparator2.Name = "BindingNavigatorSeparator2"
        Me.BindingNavigatorSeparator2.Size = New System.Drawing.Size(6, 25)
        '
        'PatientsBindingNavigatorSaveItem
        '
        Me.PatientsBindingNavigatorSaveItem.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image
        Me.PatientsBindingNavigatorSaveItem.Image = CType(resources.GetObject("PatientsBindingNavigatorSaveItem.Image"), System.Drawing.Image)
        Me.PatientsBindingNavigatorSaveItem.Name = "PatientsBindingNavigatorSaveItem"
        Me.PatientsBindingNavigatorSaveItem.Size = New System.Drawing.Size(23, 22)
        Me.PatientsBindingNavigatorSaveItem.Text = "Save Data"
        '
        'IDTextBox
        '
        Me.IDTextBox.DataBindings.Add(New System.Windows.Forms.Binding("Text", Me.PatientsBindingSource, "ID", True))
        Me.IDTextBox.Location = New System.Drawing.Point(85, 75)
        Me.IDTextBox.Name = "IDTextBox"
        Me.IDTextBox.Size = New System.Drawing.Size(100, 20)
        Me.IDTextBox.TabIndex = 13
        '
        'NameTextBox
        '
        Me.NameTextBox.DataBindings.Add(New System.Windows.Forms.Binding("Text", Me.PatientsBindingSource, "Name", True))
        Me.NameTextBox.Location = New System.Drawing.Point(85, 101)
        Me.NameTextBox.Name = "NameTextBox"
        Me.NameTextBox.Size = New System.Drawing.Size(100, 20)
        Me.NameTextBox.TabIndex = 15
        '
        'SurnameTextBox
        '
        Me.SurnameTextBox.DataBindings.Add(New System.Windows.Forms.Binding("Text", Me.PatientsBindingSource, "Surname", True))
        Me.SurnameTextBox.Location = New System.Drawing.Point(85, 127)
        Me.SurnameTextBox.Name = "SurnameTextBox"
        Me.SurnameTextBox.Size = New System.Drawing.Size(100, 20)
        Me.SurnameTextBox.TabIndex = 17
        '
        'Date_OfBirthTextBox
        '
        Me.Date_OfBirthTextBox.DataBindings.Add(New System.Windows.Forms.Binding("Text", Me.PatientsBindingSource, "Date OfBirth", True))
        Me.Date_OfBirthTextBox.Location = New System.Drawing.Point(85, 153)
        Me.Date_OfBirthTextBox.Name = "Date_OfBirthTextBox"
        Me.Date_OfBirthTextBox.Size = New System.Drawing.Size(100, 20)
        Me.Date_OfBirthTextBox.TabIndex = 19
        '
        'SexTextBox
        '
        Me.SexTextBox.DataBindings.Add(New System.Windows.Forms.Binding("Text", Me.PatientsBindingSource, "Sex", True))
        Me.SexTextBox.Location = New System.Drawing.Point(85, 179)
        Me.SexTextBox.Name = "SexTextBox"
        Me.SexTextBox.Size = New System.Drawing.Size(100, 20)
        Me.SexTextBox.TabIndex = 21
        '
        'Blood_TypeTextBox
        '
        Me.Blood_TypeTextBox.DataBindings.Add(New System.Windows.Forms.Binding("Text", Me.PatientsBindingSource, "Blood Type", True))
        Me.Blood_TypeTextBox.Location = New System.Drawing.Point(85, 205)
        Me.Blood_TypeTextBox.Name = "Blood_TypeTextBox"
        Me.Blood_TypeTextBox.Size = New System.Drawing.Size(100, 20)
        Me.Blood_TypeTextBox.TabIndex = 23
        '
        'AllergiesTextBox
        '
        Me.AllergiesTextBox.DataBindings.Add(New System.Windows.Forms.Binding("Text", Me.PatientsBindingSource, "Allergies", True))
        Me.AllergiesTextBox.Location = New System.Drawing.Point(85, 231)
        Me.AllergiesTextBox.Name = "AllergiesTextBox"
        Me.AllergiesTextBox.Size = New System.Drawing.Size(100, 20)
        Me.AllergiesTextBox.TabIndex = 25
        '
        'Address_1TextBox
        '
        Me.Address_1TextBox.DataBindings.Add(New System.Windows.Forms.Binding("Text", Me.PatientsBindingSource, "Address 1", True))
        Me.Address_1TextBox.Location = New System.Drawing.Point(286, 72)
        Me.Address_1TextBox.Name = "Address_1TextBox"
        Me.Address_1TextBox.Size = New System.Drawing.Size(100, 20)
        Me.Address_1TextBox.TabIndex = 27
        '
        'TownTextBox
        '
        Me.TownTextBox.DataBindings.Add(New System.Windows.Forms.Binding("Text", Me.PatientsBindingSource, "Town", True))
        Me.TownTextBox.Location = New System.Drawing.Point(286, 98)
        Me.TownTextBox.Name = "TownTextBox"
        Me.TownTextBox.Size = New System.Drawing.Size(100, 20)
        Me.TownTextBox.TabIndex = 29
        '
        'PostcodeTextBox
        '
        Me.PostcodeTextBox.DataBindings.Add(New System.Windows.Forms.Binding("Text", Me.PatientsBindingSource, "Postcode", True))
        Me.PostcodeTextBox.Location = New System.Drawing.Point(286, 124)
        Me.PostcodeTextBox.Name = "PostcodeTextBox"
        Me.PostcodeTextBox.Size = New System.Drawing.Size(100, 20)
        Me.PostcodeTextBox.TabIndex = 31
        '
        'Next_Of_KinTextBox
        '
        Me.Next_Of_KinTextBox.DataBindings.Add(New System.Windows.Forms.Binding("Text", Me.PatientsBindingSource, "Next Of Kin", True))
        Me.Next_Of_KinTextBox.Location = New System.Drawing.Point(518, 69)
        Me.Next_Of_KinTextBox.Name = "Next_Of_KinTextBox"
        Me.Next_Of_KinTextBox.Size = New System.Drawing.Size(100, 20)
        Me.Next_Of_KinTextBox.TabIndex = 33
        '
        'Next_Of_Kin_NumberTextBox
        '
        Me.Next_Of_Kin_NumberTextBox.DataBindings.Add(New System.Windows.Forms.Binding("Text", Me.PatientsBindingSource, "Next Of Kin Number", True))
        Me.Next_Of_Kin_NumberTextBox.Location = New System.Drawing.Point(518, 95)
        Me.Next_Of_Kin_NumberTextBox.Name = "Next_Of_Kin_NumberTextBox"
        Me.Next_Of_Kin_NumberTextBox.Size = New System.Drawing.Size(100, 20)
        Me.Next_Of_Kin_NumberTextBox.TabIndex = 35
        '
        'MainForm
        '
        Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
        Me.ClientSize = New System.Drawing.Size(1028, 531)
        Me.Controls.Add(Next_Of_Kin_NumberLabel)
        Me.Controls.Add(Me.Next_Of_Kin_NumberTextBox)
        Me.Controls.Add(Next_Of_KinLabel)
        Me.Controls.Add(Me.Next_Of_KinTextBox)
        Me.Controls.Add(PostcodeLabel)
        Me.Controls.Add(Me.PostcodeTextBox)
        Me.Controls.Add(TownLabel)
        Me.Controls.Add(Me.TownTextBox)
        Me.Controls.Add(Address_1Label)
        Me.Controls.Add(Me.Address_1TextBox)
        Me.Controls.Add(AllergiesLabel)
        Me.Controls.Add(Me.AllergiesTextBox)
        Me.Controls.Add(Blood_TypeLabel)
        Me.Controls.Add(Me.Blood_TypeTextBox)
        Me.Controls.Add(SexLabel)
        Me.Controls.Add(Me.SexTextBox)
        Me.Controls.Add(Date_OfBirthLabel)
        Me.Controls.Add(Me.Date_OfBirthTextBox)
        Me.Controls.Add(SurnameLabel)
        Me.Controls.Add(Me.SurnameTextBox)
        Me.Controls.Add(NameLabel)
        Me.Controls.Add(Me.NameTextBox)
        Me.Controls.Add(IDLabel)
        Me.Controls.Add(Me.IDTextBox)
        Me.Controls.Add(Me.PatientsBindingNavigator)
        Me.Controls.Add(Me.ckAutoExtract)
        Me.Controls.Add(Me.ExtractButton)
        Me.Controls.Add(Me.AxGrFingerXCtrl1)
        Me.Controls.Add(Me.LogList)
        Me.Controls.Add(Me.ckBoxAutoIdentify)
        Me.Controls.Add(Me.ClearLogButton)
        Me.Controls.Add(Me.ClearDatabaseButton)
        Me.Controls.Add(Me.IdentifyButton)
        Me.Controls.Add(Me.VerifyButton)
        Me.Controls.Add(Me.EnrollButton)
        Me.Controls.Add(Me.PictureBox1)
        Me.Icon = CType(resources.GetObject("$this.Icon"), System.Drawing.Icon)
        Me.Menu = Me.MainMenu1
        Me.Name = "MainForm"
        Me.Text = "GrFingerX - Sample application - VB.NET 2005"
        CType(Me.PictureBox1, System.ComponentModel.ISupportInitialize).EndInit()
        CType(Me.AxGrFingerXCtrl1, System.ComponentModel.ISupportInitialize).EndInit()
        CType(Me.Patients1DataSet, System.ComponentModel.ISupportInitialize).EndInit()
        CType(Me.PatientsBindingSource, System.ComponentModel.ISupportInitialize).EndInit()
        CType(Me.PatientsBindingNavigator, System.ComponentModel.ISupportInitialize).EndInit()
        Me.PatientsBindingNavigator.ResumeLayout(False)
        Me.PatientsBindingNavigator.PerformLayout()
        Me.ResumeLayout(False)
        Me.PerformLayout()

    End Sub

#End Region

    ' the options form
    Dim OptionsForm1 As New OptionsForm
    ' the util class
    Dim myUtil As Util

    ' Application startup code
    Private Sub MainForm_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        'TODO: This line of code loads data into the 'Patients1DataSet.Patients' table. You can move, or remove it, as needed.
        Me.PatientsTableAdapter.Fill(Me.Patients1DataSet.Patients)
        Dim err As Integer
        ' initialize util class
        myUtil = New Util(LogList, PictureBox1, AxGrFingerXCtrl1)

        ' Initialize GrFingerX Library
        err = myUtil.InitializeGrFinger()
        ' Print result in log
        If err < 0 Then
            myUtil.WriteError(err)
            Exit Sub
        Else
            myUtil.WriteLog("**GrFingerX Initialized Successfull**")
        End If
    End Sub

    ' Application finalization code
    Private Sub MainForm_Close(ByVal sender As System.Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles MyBase.Closing
        myUtil.FinalizeGrFinger()
    End Sub

    ' Add a fingerprint to database
    Private Sub EnrollButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles EnrollButton.Click
        Dim id As Integer

        ' add fingerprint
        id = myUtil.Enroll()
        ' write result to log
        If id >= 0 Then
            myUtil.WriteLog("Fingerprint enrolled with id = " & id)
        Else
            myUtil.WriteLog("Error: Fingerprint not enrolled")
        End If
    End Sub

    ' Identify a fingerprint
    Private Sub IdentifyButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles IdentifyButton.Click
        Dim ret As Integer, score As Integer

        score = 0
        ' identify it
        ret = myUtil.Identify(score)
        ' write result to log
        If ret > 0 Then
            myUtil.WriteLog("Fingerprint identified. ID = " & ret & ". Score = " & score & ".")
            BindingNavigatorPositionItem.Text = ret
            BindingNavigatorPositionItem.Focus()
            Me.Focus()






            myUtil.PrintBiometricDisplay(True, GRConstants.GR_DEFAULT_CONTEXT)
        ElseIf ret = 0 Then
            myUtil.WriteLog("Fingerprint not Found.")
        Else
            myUtil.WriteError(ret)
        End If
    End Sub

    ' Check a fingerprint
    Private Sub VerifyButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles VerifyButton.Click
        Dim ret As Integer
        Dim score As Integer
        Dim sid As String

        ' ask target fingerprint ID
        score = 0
        sid = InputBox("Enter the ID to verify", "Verify", "")
        If sid <> "" Then
            ' compare fingerprints
            ret = myUtil.Verify(Val(sid), score)
            ' write result to log
            If ret < 0 Then
                myUtil.WriteError(ret)
            ElseIf ret = GRConstants.GR_NOT_MATCH Then
                myUtil.WriteLog("Did not match with score = " & score)
            Else
                myUtil.WriteLog("Matched with score = " & score)
                ' if they match, display matching minutiae/segments/directions
                myUtil.PrintBiometricDisplay(True, GRConstants.GR_DEFAULT_CONTEXT)
            End If
        End If
    End Sub

    ' Extract a template from a fingerprint image
    Private Sub ExtractButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ExtractButton.Click
        Dim ret As Integer

        ' extract template
        ret = myUtil.ExtractTemplate()
        ' write template quality to log
        If ret = GRConstants.GR_BAD_QUALITY Then
            myUtil.WriteLog("Template extracted successfully. Bad quality.")
        ElseIf ret = GRConstants.GR_MEDIUM_QUALITY Then
            myUtil.WriteLog("Template extracted successfully. Medium quality.")
        ElseIf ret = GRConstants.GR_HIGH_QUALITY Then
            myUtil.WriteLog("Template extracted successfully. High quality.")
        End If
        If ret >= 0 Then
            ' if no error, display minutiae/segments/directions into the image
            myUtil.PrintBiometricDisplay(True, GRConstants.GR_NO_CONTEXT)
            ' enable operations we can do over extracted template
            ExtractButton.Enabled = False
            EnrollButton.Enabled = True
            IdentifyButton.Enabled = True
            VerifyButton.Enabled = True
        Else
            ' write error to log
            myUtil.WriteError(ret)
        End If
    End Sub

    ' Clear database
    Private Sub ClearDatabaseButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ClearDatabaseButton.Click
        ' clear database
        myUtil.DB.clearDB()
        ' write result to log
        myUtil.WriteLog("Database is clear...")
    End Sub

    ' Clear log
    Private Sub ClearLogButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ClearLogButton.Click
        LogList.Items.Clear()
    End Sub

    ' Save fingerprint image to a file
    Private Sub MenuSave_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MenuSave.Click
        Dim SaveFileDialog1 As New SaveFileDialog

        ' we need an image
        If myUtil.raw.img Is Nothing Then
            MsgBox("There is no image to save.")
            Return
        End If

        ' open "save" dialog
        SaveFileDialog1.Filter = "BMP files (*.bmp)|*.bmp|All files (*.*)|*.*"
        SaveFileDialog1.FilterIndex = 1
        SaveFileDialog1.RestoreDirectory = True

        ' save image
        If SaveFileDialog1.ShowDialog() = Windows.Forms.DialogResult.OK Then
            If AxGrFingerXCtrl1.CapSaveRawImageToFile(myUtil.raw.img, myUtil.raw.width, myUtil.raw.height, SaveFileDialog1.FileName, GRConstants.GRCAP_IMAGE_FORMAT_BMP) <> GRConstants.GR_OK Then
                myUtil.WriteLog("Fail to save the file.")
            End If
        End If
    End Sub

    ' Load a fingerprint image from a file
    Private Sub MenuLoad_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MenuLoad.Click
        Dim OpenFileDialog1 As New OpenFileDialog
        Dim resolution As Integer

        ' open "load" dialog
        OpenFileDialog1.Filter = "BMP files (*.bmp)|*.bmp|All files (*.*)|*.*"
        OpenFileDialog1.FilterIndex = 1
        OpenFileDialog1.RestoreDirectory = True

        ' load image
        If OpenFileDialog1.ShowDialog() = Windows.Forms.DialogResult.OK Then
            ' Getting resolution.
            resolution = Val(InputBox("What is the image resolution?", "Resolution", ""))
            ' Checking if action was canceled, no value or an invalid value was entered.
            If (resolution <> 0) Then
                If AxGrFingerXCtrl1.CapLoadImageFromFile(OpenFileDialog1.FileName, resolution) <> GRConstants.GR_OK Then
                    myUtil.WriteLog("Fail to load the file.")
                End If
            End If
        End If
    End Sub

    ' Open "Options" window
    Private Sub MenuOptions_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MenuOptions.Click
        Dim ret As Integer
        Dim thresholdId As Integer
        Dim rotationMaxId As Integer
        Dim thresholdVr As Integer
        Dim rotationMaxVr As Integer
        Dim minutiaeColor As Integer
        Dim minutiaeMatchColor As Integer
        Dim segmentsColor As Integer
        Dim segmentsMatchColor As Integer
        Dim directionsColor As Integer
        Dim directionsMatchColor As Integer
        Dim ok As Boolean

        Do
            ' get current identification/verification parameters
            AxGrFingerXCtrl1.GetIdentifyParameters(thresholdId, rotationMaxId, GRConstants.GR_DEFAULT_CONTEXT)
            AxGrFingerXCtrl1.GetVerifyParameters(thresholdVr, rotationMaxVr, GRConstants.GR_DEFAULT_CONTEXT)
            ' set current identification/verification parameters on options form
            OptionsForm1.setParameters(thresholdId, rotationMaxId, thresholdVr, rotationMaxVr)

            ' show form with match option and biometric display options
            If OptionsForm1.ShowDialog() = Windows.Forms.DialogResult.Cancel Then Return
            ok = True
            ' get new parameters 
            OptionsForm1.getParameters(thresholdId, rotationMaxId, thresholdVr, rotationMaxVr, _
                  minutiaeColor, minutiaeMatchColor, segmentsColor, segmentsMatchColor, directionsColor, directionsMatchColor)

            If (thresholdId < GRConstants.GR_MIN_THRESHOLD Or _
             thresholdId > GRConstants.GR_MAX_THRESHOLD Or _
             rotationMaxId < GRConstants.GR_ROT_MIN Or _
             rotationMaxId > GRConstants.GR_ROT_MAX) Then
                MsgBox("Invalid identify parameters values!")
                ok = False
            End If
            If (thresholdVr < GRConstants.GR_MIN_THRESHOLD Or _
             thresholdVr > GRConstants.GR_MAX_THRESHOLD Or _
             rotationMaxVr < GRConstants.GR_ROT_MIN Or _
             rotationMaxVr > GRConstants.GR_ROT_MAX) Then
                MsgBox("Invalid verify parameters values!")
                ok = False
            End If
            ' set new identification parameters
            If ok Then
                ret = AxGrFingerXCtrl1.SetIdentifyParameters(thresholdId, rotationMaxId, GRConstants.GR_DEFAULT_CONTEXT)
                ' error?
                If ret = GRConstants.GR_DEFAULT_USED Then
                    MsgBox("Invalid identify parameters values. Default values will be used.")
                    ok = False
                End If
                ' set new verification parameters
                ret = AxGrFingerXCtrl1.SetVerifyParameters(thresholdVr, rotationMaxVr, GRConstants.GR_DEFAULT_CONTEXT)
                ' error?
                If ret = GRConstants.GR_DEFAULT_USED Then
                    MsgBox("Invalid verify parameters values. Default values will be used.")
                    ok = False
                End If
                ' if everything ok
                If ok Then
                    ' accept new parameters
                    OptionsForm1.AcceptChanges()
                    ' set new colors
                    AxGrFingerXCtrl1.SetBiometricDisplayColors(minutiaeColor, minutiaeMatchColor, segmentsColor, segmentsMatchColor, directionsColor, directionsMatchColor)
                    Return
                End If
            End If
        Loop
    End Sub

    ' Display GrFinger version
    Private Sub MenuVersion_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MenuVersion.Click
        myUtil.MessageVersion()
    End Sub

    ' -----------------------------------------------------------------------------------
    ' GrFingerX events
    ' -----------------------------------------------------------------------------------

    ' A fingerprint reader was plugged on system
    Private Sub AxGrFingerXCtrl1_SensorPlug(ByVal sender As System.Object, ByVal e As AxGrFingerXLib._IGrFingerXCtrlEvents_SensorPlugEvent) Handles AxGrFingerXCtrl1.SensorPlug
        myUtil.WriteLog("Sensor: " & e.idSensor & ". Event: Plugged.")
        AxGrFingerXCtrl1.CapStartCapture(e.idSensor)
    End Sub

    ' A fingerprint reader was unplugged from system
    Private Sub AxGrFingerXCtrl1_SensorUnplug(ByVal sender As System.Object, ByVal e As AxGrFingerXLib._IGrFingerXCtrlEvents_SensorUnplugEvent) Handles AxGrFingerXCtrl1.SensorUnplug
        myUtil.WriteLog("Sensor: " & e.idSensor & ". Event: Unplugged.")
        AxGrFingerXCtrl1.CapStopCapture(e.idSensor)
    End Sub

    ' A finger was placed on reader
    Private Sub AxGrFingerXCtrl1_FingerDown(ByVal sender As System.Object, ByVal e As AxGrFingerXLib._IGrFingerXCtrlEvents_FingerDownEvent) Handles AxGrFingerXCtrl1.FingerDown
        myUtil.WriteLog("Sensor: " & e.idSensor & ". Event: Finger Placed.")
    End Sub

    ' A finger was removed from reader
    Private Sub AxGrFingerXCtrl1_FingerUp(ByVal sender As System.Object, ByVal e As AxGrFingerXLib._IGrFingerXCtrlEvents_FingerUpEvent) Handles AxGrFingerXCtrl1.FingerUp
        myUtil.WriteLog("Sensor: " & e.idSensor & ". Event: Finger removed.")
    End Sub

    ' An image was acquired from reader
    Private Sub AxGrFingerXCtrl1_ImageAcquired(ByVal sender As System.Object, ByVal e As AxGrFingerXLib._IGrFingerXCtrlEvents_ImageAcquiredEvent) Handles AxGrFingerXCtrl1.ImageAcquired
        ' Copying aquired image
        myUtil.raw.height = e.height
        myUtil.raw.width = e.width
        myUtil.raw.res = e.res
        myUtil.raw.img = e.rawImage

        ' Signaling that an Image Event occurred.
        myUtil.WriteLog("Sensor: " & e.idSensor & ". Event: Image captured.")

        ' display fingerprint image
        myUtil.PrintBiometricDisplay(False, GRConstants.GR_DEFAULT_CONTEXT)

        ' now we have a fingerprint, so we can extract template
        ExtractButton.Enabled = True
        EnrollButton.Enabled = False
        IdentifyButton.Enabled = False
        VerifyButton.Enabled = False

        ' extracting template from image
        If ckAutoExtract.Checked Then ExtractButton.PerformClick()

        ' identify fingerprint
        If ckBoxAutoIdentify.Checked Then IdentifyButton().PerformClick()
    End Sub

    Private Sub PatientsBindingNavigatorSaveItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PatientsBindingNavigatorSaveItem.Click
        Me.Validate()
        Me.PatientsBindingSource.EndEdit()
        Me.TableAdapterManager.UpdateAll(Me.Patients1DataSet)

    End Sub

    Private Sub IDTextBox_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles IDTextBox.TextChanged

    End Sub
End Class

Edited 6 Years Ago by __avd: Added [code] tags. For easy readability, always wrap programming code within posts in [code] (code blocks).

This article has been dead for over six months. Start a new discussion instead.