'This source code has been developed by Cuong Pham (cuong@nmsu.edu) & Mary Lucero
'Any use of this software MUST contain this message.
Public Class FrGenomicDNA
    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 DataGrid1 As System.Windows.Forms.DataGrid
    Friend WithEvents Label2 As System.Windows.Forms.Label
    Friend WithEvents TxBoxname As System.Windows.Forms.TextBox
    Friend WithEvents Label3 As System.Windows.Forms.Label
    Friend WithEvents TxColumn As System.Windows.Forms.TextBox
    Friend WithEvents Label4 As System.Windows.Forms.Label
    Friend WithEvents TxRow As System.Windows.Forms.TextBox
    Friend WithEvents Label6 As System.Windows.Forms.Label
    Friend WithEvents TxLocation As System.Windows.Forms.TextBox
    Friend WithEvents Label7 As System.Windows.Forms.Label
    Friend WithEvents Label8 As System.Windows.Forms.Label
    Friend WithEvents TxDescription As System.Windows.Forms.TextBox
    Friend WithEvents Label9 As System.Windows.Forms.Label
    Friend WithEvents TxSource As System.Windows.Forms.TextBox
    Friend WithEvents Label10 As System.Windows.Forms.Label
    Friend WithEvents Label11 As System.Windows.Forms.Label
    Friend WithEvents Tx260_280Ratio As System.Windows.Forms.TextBox
    Friend WithEvents Label12 As System.Windows.Forms.Label
    Friend WithEvents Tx230_260Ratio As System.Windows.Forms.TextBox
    Friend WithEvents Label14 As System.Windows.Forms.Label
    Friend WithEvents TxEstimatedVolume As System.Windows.Forms.TextBox
    Friend WithEvents Label15 As System.Windows.Forms.Label
    Friend WithEvents TxDate As System.Windows.Forms.TextBox
    Friend WithEvents Label16 As System.Windows.Forms.Label
    Friend WithEvents TxKitUsed As System.Windows.Forms.TextBox
    Friend WithEvents Label17 As System.Windows.Forms.Label
    Friend WithEvents TxPurificationMethod As System.Windows.Forms.TextBox
    Friend WithEvents ButAdd As System.Windows.Forms.Button
    Friend WithEvents ButUpdate As System.Windows.Forms.Button
    Friend WithEvents ButDelete As System.Windows.Forms.Button
    Friend WithEvents ButQuit As System.Windows.Forms.Button
    Friend WithEvents TxnguLDNA As System.Windows.Forms.TextBox
    Friend WithEvents cbTissue As System.Windows.Forms.ComboBox
    Friend WithEvents ckAvailable As System.Windows.Forms.CheckBox
    <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
        Me.DataGrid1 = New System.Windows.Forms.DataGrid
        Me.Label2 = New System.Windows.Forms.Label
        Me.TxBoxname = New System.Windows.Forms.TextBox
        Me.Label3 = New System.Windows.Forms.Label
        Me.TxColumn = New System.Windows.Forms.TextBox
        Me.Label4 = New System.Windows.Forms.Label
        Me.TxRow = New System.Windows.Forms.TextBox
        Me.Label6 = New System.Windows.Forms.Label
        Me.TxLocation = New System.Windows.Forms.TextBox
        Me.Label7 = New System.Windows.Forms.Label
        Me.cbTissue = New System.Windows.Forms.ComboBox
        Me.Label8 = New System.Windows.Forms.Label
        Me.TxDescription = New System.Windows.Forms.TextBox
        Me.Label9 = New System.Windows.Forms.Label
        Me.TxSource = New System.Windows.Forms.TextBox
        Me.Label10 = New System.Windows.Forms.Label
        Me.TxnguLDNA = New System.Windows.Forms.TextBox
        Me.Label11 = New System.Windows.Forms.Label
        Me.Tx260_280Ratio = New System.Windows.Forms.TextBox
        Me.Label12 = New System.Windows.Forms.Label
        Me.Tx230_260Ratio = New System.Windows.Forms.TextBox
        Me.Label14 = New System.Windows.Forms.Label
        Me.TxEstimatedVolume = New System.Windows.Forms.TextBox
        Me.Label15 = New System.Windows.Forms.Label
        Me.TxDate = New System.Windows.Forms.TextBox
        Me.Label16 = New System.Windows.Forms.Label
        Me.TxKitUsed = New System.Windows.Forms.TextBox
        Me.Label17 = New System.Windows.Forms.Label
        Me.TxPurificationMethod = New System.Windows.Forms.TextBox
        Me.ButAdd = New System.Windows.Forms.Button
        Me.ButUpdate = New System.Windows.Forms.Button
        Me.ButDelete = New System.Windows.Forms.Button
        Me.ButQuit = New System.Windows.Forms.Button
        Me.ckAvailable = New System.Windows.Forms.CheckBox
        CType(Me.DataGrid1, System.ComponentModel.ISupportInitialize).BeginInit()
        Me.SuspendLayout()
        '
        'DataGrid1
        '
        Me.DataGrid1.DataMember = "GenomicDNA_Stocks"
        Me.DataGrid1.HeaderForeColor = System.Drawing.SystemColors.ControlText
        Me.DataGrid1.Location = New System.Drawing.Point(0, 0)
        Me.DataGrid1.Name = "DataGrid1"
        Me.DataGrid1.Size = New System.Drawing.Size(720, 248)
        Me.DataGrid1.TabIndex = 0
        '
        'Label2
        '
        Me.Label2.Location = New System.Drawing.Point(0, 260)
        Me.Label2.Name = "Label2"
        Me.Label2.Size = New System.Drawing.Size(88, 24)
        Me.Label2.TabIndex = 3
        Me.Label2.Text = "Box Name"
        '
        'TxBoxname
        '
        Me.TxBoxname.Location = New System.Drawing.Point(96, 260)
        Me.TxBoxname.Name = "TxBoxname"
        Me.TxBoxname.Size = New System.Drawing.Size(176, 20)
        Me.TxBoxname.TabIndex = 4
        Me.TxBoxname.Text = "TextBox1"
        '
        'Label3
        '
        Me.Label3.Location = New System.Drawing.Point(1, 292)
        Me.Label3.Name = "Label3"
        Me.Label3.Size = New System.Drawing.Size(80, 24)
        Me.Label3.TabIndex = 5
        Me.Label3.Text = "Column"
        '
        'TxColumn
        '
        Me.TxColumn.Location = New System.Drawing.Point(96, 292)
        Me.TxColumn.Name = "TxColumn"
        Me.TxColumn.Size = New System.Drawing.Size(176, 20)
        Me.TxColumn.TabIndex = 6
        Me.TxColumn.Text = "TextBox1"
        '
        'Label4
        '
        Me.Label4.Location = New System.Drawing.Point(0, 328)
        Me.Label4.Name = "Label4"
        Me.Label4.Size = New System.Drawing.Size(88, 24)
        Me.Label4.TabIndex = 7
        Me.Label4.Text = "Row"
        '
        'TxRow
        '
        Me.TxRow.Location = New System.Drawing.Point(96, 328)
        Me.TxRow.Name = "TxRow"
        Me.TxRow.Size = New System.Drawing.Size(176, 20)
        Me.TxRow.TabIndex = 8
        Me.TxRow.Text = "TextBox1"
        '
        'Label6
        '
        Me.Label6.Location = New System.Drawing.Point(0, 392)
        Me.Label6.Name = "Label6"
        Me.Label6.Size = New System.Drawing.Size(80, 24)
        Me.Label6.TabIndex = 11
        Me.Label6.Text = "Location"
        '
        'TxLocation
        '
        Me.TxLocation.Location = New System.Drawing.Point(96, 392)
        Me.TxLocation.Name = "TxLocation"
        Me.TxLocation.Size = New System.Drawing.Size(176, 20)
        Me.TxLocation.TabIndex = 12
        Me.TxLocation.Text = "TextBox1"
        '
        'Label7
        '
        Me.Label7.Location = New System.Drawing.Point(0, 426)
        Me.Label7.Name = "Label7"
        Me.Label7.Size = New System.Drawing.Size(80, 24)
        Me.Label7.TabIndex = 13
        Me.Label7.Text = "Tissue"
        '
        'cbTissue
        '
        Me.cbTissue.Location = New System.Drawing.Point(96, 426)
        Me.cbTissue.Name = "cbTissue"
        Me.cbTissue.Size = New System.Drawing.Size(176, 21)
        Me.cbTissue.TabIndex = 14
        Me.cbTissue.Text = "ComboBox1"
        '
        'Label8
        '
        Me.Label8.Location = New System.Drawing.Point(0, 457)
        Me.Label8.Name = "Label8"
        Me.Label8.Size = New System.Drawing.Size(72, 24)
        Me.Label8.TabIndex = 15
        Me.Label8.Text = "Description"
        '
        'TxDescription
        '
        Me.TxDescription.Location = New System.Drawing.Point(96, 461)
        Me.TxDescription.Name = "TxDescription"
        Me.TxDescription.Size = New System.Drawing.Size(176, 20)
        Me.TxDescription.TabIndex = 16
        Me.TxDescription.Text = "TextBox1"
        '
        'Label9
        '
        Me.Label9.Location = New System.Drawing.Point(307, 260)
        Me.Label9.Name = "Label9"
        Me.Label9.Size = New System.Drawing.Size(64, 24)
        Me.Label9.TabIndex = 17
        Me.Label9.Text = "Source"
        '
        'TxSource
        '
        Me.TxSource.Location = New System.Drawing.Point(393, 261)
        Me.TxSource.Name = "TxSource"
        Me.TxSource.Size = New System.Drawing.Size(181, 20)
        Me.TxSource.TabIndex = 18
        Me.TxSource.Text = "TextBox1"
        '
        'Label10
        '
        Me.Label10.Location = New System.Drawing.Point(307, 296)
        Me.Label10.Name = "Label10"
        Me.Label10.Size = New System.Drawing.Size(72, 21)
        Me.Label10.TabIndex = 19
        Me.Label10.Text = "ng/uL DNA"
        '
        'TxnguLDNA
        '
        Me.TxnguLDNA.Location = New System.Drawing.Point(393, 294)
        Me.TxnguLDNA.Name = "TxnguLDNA"
        Me.TxnguLDNA.Size = New System.Drawing.Size(182, 20)
        Me.TxnguLDNA.TabIndex = 20
        Me.TxnguLDNA.Text = "TextBox1"
        '
        'Label11
        '
        Me.Label11.Location = New System.Drawing.Point(307, 331)
        Me.Label11.Name = "Label11"
        Me.Label11.Size = New System.Drawing.Size(75, 24)
        Me.Label11.TabIndex = 21
        Me.Label11.Text = "260/280 ratio"
        '
        'Tx260_280Ratio
        '
        Me.Tx260_280Ratio.Location = New System.Drawing.Point(393, 326)
        Me.Tx260_280Ratio.Name = "Tx260_280Ratio"
        Me.Tx260_280Ratio.Size = New System.Drawing.Size(183, 20)
        Me.Tx260_280Ratio.TabIndex = 22
        Me.Tx260_280Ratio.Text = "TextBox1"
        '
        'Label12
        '
        Me.Label12.Location = New System.Drawing.Point(307, 361)
        Me.Label12.Name = "Label12"
        Me.Label12.Size = New System.Drawing.Size(80, 24)
        Me.Label12.TabIndex = 23
        Me.Label12.Text = "230/260 ratio"
        '
        'Tx230_260Ratio
        '
        Me.Tx230_260Ratio.Location = New System.Drawing.Point(392, 359)
        Me.Tx230_260Ratio.Name = "Tx230_260Ratio"
        Me.Tx230_260Ratio.Size = New System.Drawing.Size(184, 20)
        Me.Tx230_260Ratio.TabIndex = 24
        Me.Tx230_260Ratio.Text = "TextBox2"
        '
        'Label14
        '
        Me.Label14.Location = New System.Drawing.Point(288, 397)
        Me.Label14.Name = "Label14"
        Me.Label14.Size = New System.Drawing.Size(96, 24)
        Me.Label14.TabIndex = 27
        Me.Label14.Text = "Estimated Volume"
        '
        'TxEstimatedVolume
        '
        Me.TxEstimatedVolume.Location = New System.Drawing.Point(392, 393)
        Me.TxEstimatedVolume.Name = "TxEstimatedVolume"
        Me.TxEstimatedVolume.Size = New System.Drawing.Size(176, 20)
        Me.TxEstimatedVolume.TabIndex = 28
        Me.TxEstimatedVolume.Text = "TextBox1"
        '
        'Label15
        '
        Me.Label15.Location = New System.Drawing.Point(309, 429)
        Me.Label15.Name = "Label15"
        Me.Label15.Size = New System.Drawing.Size(54, 24)
        Me.Label15.TabIndex = 29
        Me.Label15.Text = "Date"
        '
        'TxDate
        '
        Me.TxDate.Location = New System.Drawing.Point(392, 425)
        Me.TxDate.Name = "TxDate"
        Me.TxDate.Size = New System.Drawing.Size(184, 20)
        Me.TxDate.TabIndex = 30
        Me.TxDate.Text = "TextBox1"
        '
        'Label16
        '
        Me.Label16.Location = New System.Drawing.Point(310, 459)
        Me.Label16.Name = "Label16"
        Me.Label16.Size = New System.Drawing.Size(66, 16)
        Me.Label16.TabIndex = 31
        Me.Label16.Text = "Kit used"
        '
        'TxKitUsed
        '
        Me.TxKitUsed.Location = New System.Drawing.Point(392, 457)
        Me.TxKitUsed.Name = "TxKitUsed"
        Me.TxKitUsed.Size = New System.Drawing.Size(184, 20)
        Me.TxKitUsed.TabIndex = 32
        Me.TxKitUsed.Text = "TextBox1"
        '
        'Label17
        '
        Me.Label17.Location = New System.Drawing.Point(0, 506)
        Me.Label17.Name = "Label17"
        Me.Label17.Size = New System.Drawing.Size(88, 24)
        Me.Label17.TabIndex = 33
        Me.Label17.Text = "Comments"
        '
        'TxPurificationMethod
        '
        Me.TxPurificationMethod.Location = New System.Drawing.Point(95, 506)
        Me.TxPurificationMethod.Name = "TxPurificationMethod"
        Me.TxPurificationMethod.Size = New System.Drawing.Size(625, 20)
        Me.TxPurificationMethod.TabIndex = 34
        Me.TxPurificationMethod.Text = "TextBox1"
        '
        'ButAdd
        '
        Me.ButAdd.Location = New System.Drawing.Point(584, 256)
        Me.ButAdd.Name = "ButAdd"
        Me.ButAdd.Size = New System.Drawing.Size(136, 48)
        Me.ButAdd.TabIndex = 35
        Me.ButAdd.Text = "Add Genomic DNA"
        '
        'ButUpdate
        '
        Me.ButUpdate.Location = New System.Drawing.Point(584, 320)
        Me.ButUpdate.Name = "ButUpdate"
        Me.ButUpdate.Size = New System.Drawing.Size(136, 48)
        Me.ButUpdate.TabIndex = 36
        Me.ButUpdate.Text = "Update"
        '
        'ButDelete
        '
        Me.ButDelete.Location = New System.Drawing.Point(586, 383)
        Me.ButDelete.Name = "ButDelete"
        Me.ButDelete.Size = New System.Drawing.Size(136, 48)
        Me.ButDelete.TabIndex = 37
        Me.ButDelete.Text = "Delete"
        '
        'ButQuit
        '
        Me.ButQuit.Location = New System.Drawing.Point(584, 448)
        Me.ButQuit.Name = "ButQuit"
        Me.ButQuit.Size = New System.Drawing.Size(136, 48)
        Me.ButQuit.TabIndex = 38
        Me.ButQuit.Text = "Quit"
        '
        'ckAvailable
        '
        Me.ckAvailable.Location = New System.Drawing.Point(96, 360)
        Me.ckAvailable.Name = "ckAvailable"
        Me.ckAvailable.Size = New System.Drawing.Size(176, 24)
        Me.ckAvailable.TabIndex = 39
        Me.ckAvailable.Text = "Available"
        '
        'FrGenomicDNA
        '
        Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
        Me.ClientSize = New System.Drawing.Size(736, 550)
        Me.Controls.Add(Me.ckAvailable)
        Me.Controls.Add(Me.ButQuit)
        Me.Controls.Add(Me.ButDelete)
        Me.Controls.Add(Me.ButUpdate)
        Me.Controls.Add(Me.ButAdd)
        Me.Controls.Add(Me.TxPurificationMethod)
        Me.Controls.Add(Me.Label17)
        Me.Controls.Add(Me.TxKitUsed)
        Me.Controls.Add(Me.Label16)
        Me.Controls.Add(Me.TxDate)
        Me.Controls.Add(Me.Label15)
        Me.Controls.Add(Me.TxEstimatedVolume)
        Me.Controls.Add(Me.Label14)
        Me.Controls.Add(Me.Tx230_260Ratio)
        Me.Controls.Add(Me.Label12)
        Me.Controls.Add(Me.Tx260_280Ratio)
        Me.Controls.Add(Me.Label11)
        Me.Controls.Add(Me.TxnguLDNA)
        Me.Controls.Add(Me.Label10)
        Me.Controls.Add(Me.TxSource)
        Me.Controls.Add(Me.Label9)
        Me.Controls.Add(Me.TxDescription)
        Me.Controls.Add(Me.Label8)
        Me.Controls.Add(Me.cbTissue)
        Me.Controls.Add(Me.Label7)
        Me.Controls.Add(Me.TxLocation)
        Me.Controls.Add(Me.Label6)
        Me.Controls.Add(Me.TxRow)
        Me.Controls.Add(Me.Label4)
        Me.Controls.Add(Me.TxColumn)
        Me.Controls.Add(Me.Label3)
        Me.Controls.Add(Me.TxBoxname)
        Me.Controls.Add(Me.Label2)
        Me.Controls.Add(Me.DataGrid1)
        Me.Name = "FrGenomicDNA"
        Me.Text = "Genomic DNA Stocks"
        CType(Me.DataGrid1, System.ComponentModel.ISupportInitialize).EndInit()
        Me.ResumeLayout(False)

    End Sub

#End Region
    Private Mode As Integer
    Private ID As Integer
    Private Sub ButQuit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButQuit.Click
        Me.Hide()
    End Sub
    Private Sub Load_GenomicDNA()
        Init()
        Dim SQLs As String
        Dim SQL1 As String
        Dim t As String

        Dim connString As String = strConn
        Dim myConnection As OleDb.OleDbConnection = New OleDb.OleDbConnection
        myConnection.ConnectionString = connString
        ' create a data adapter 
        SQLs = "SELECT ID,BoxName,Column1,Row, Available, " & _
                "  Location,TissueID,Description,Source,[ng/uLDNA],[260/280ratio],[230/260ratio], " & _
                "  EstimatedVolume, DateIsolate, Comments, KitUsed FROM GenomicDNA_Stocks ORDER BY ID"

        SQL1 = "SELECT * FROM GenomicDNA_Stocks ORDER BY ID "
        Dim da As OleDb.OleDbDataAdapter = New OleDb.OleDbDataAdapter(SQL1, myConnection)
        ' create a new dataset 
        Dim ds As DataSet = New DataSet
        ' fill dataset 
        da.Fill(ds, "GenomicDNA_Stocks")

        ' write dataset contents to an xml file by calling WriteXml method 
        ' Attach DataSet to DataGrid

        DataGrid1.DataSource = ds.DefaultViewManager
        DataGrid1.DataMember = "GenomicDNA_Stocks"
        DataGrid1.ColumnHeadersVisible = True
        DataGrid1.Refresh()
        myConnection.Close()

        TxBoxname.Text = ""
        TxColumn.Text = ""
        TxRow.Text = ""
        ckAvailable.Checked = True
        TxLocation.Text = ""



        'cbTissue.Items.GetEnumerator(ds1)
        cbTissue.Items.Clear()
        FillComboBox(cbTissue, "Tissues", "Description")
        cbTissue.Text = ""

        TxDescription.Text = ""
        TxSource.Text = ""
        TxnguLDNA.Text = ""
        Tx260_280Ratio.Text = ""
        Tx230_260Ratio.Text = ""

        TxEstimatedVolume.Text = ""
        TxDate.Text = ""
        TxPurificationMethod.Text = ""
        TxKitUsed.Text = ""

    End Sub
    Private Sub FrGenomicDNA_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        ShowToolTip()
        Load_GenomicDNA()
    End Sub
    Private Sub DataGrid1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DataGrid1.Click
        Dim i As Integer, s As String
        Dim t As Boolean
        t = False
        Flush()
        Mode = 1
        i = 0
        On Error Resume Next
        While (t = False)
            If DataGrid1.IsSelected(i) Then
                ID = CInt(DataGrid1.Item(i, 0))

                TxBoxname.Text = DataGrid1.Item(i, 1)
                TxColumn.Text = DataGrid1.Item(i, 2)
                TxRow.Text = DataGrid1.Item(i, 3)
                ckAvailable.Checked = DataGrid1.Item(i, 4)
                TxLocation.Text = DataGrid1.Item(i, 5)


                s = getName("tissues", "tissueID", "Description", DataGrid1.Item(i, 6))

                'MsgBox(s)

                cbTissue.Text = s

                TxDescription.Text = DataGrid1.Item(i, 7)
                TxSource.Text = DataGrid1.Item(i, 8)
                TxnguLDNA.Text = DataGrid1.Item(i, 9)
                Tx260_280Ratio.Text = DataGrid1.Item(i, 10)
                Tx230_260Ratio.Text = DataGrid1.Item(i, 11)
                TxEstimatedVolume.Text = DataGrid1.Item(i, 12)
                TxDate.Text = DataGrid1.Item(i, 13)
                TxPurificationMethod.Text = DataGrid1.Item(i, 14)
                TxKitUsed.Text = DataGrid1.Item(i, 15)

                ButUpdate.Enabled = True
                ButDelete.Enabled = True
                t = True
            End If
            i = i + 1
        End While
    End Sub

    Private Sub TxBoxNumber_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs)

    End Sub

    Private Sub Label5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)

    End Sub

    Private Sub ButUpdate_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButUpdate.Click
        Dim strSQL As String
        Dim sSQL As String, t As String
        Dim tissueID As Integer
        On Error Resume Next
        OpenConn()

        If Mode = 0 Then
            t = getID("tissues", "tissueID", "Description", cbTissue.Text)
            If Len(t) > 0 Then
                tissueID = CInt(t)
            End If

            strSQL = "INSERT INTO GenomicDNA_Stocks(BoxName,Column1,Row," & _
            "Available,Location,TissueID,Description,Source,[ng/uLDNA]," & _
            "[260/280ratio],[230/260ratio], EstimatedVolume,DateIsolate," & _
            "Comments,KitUsed)" & _
            " VALUES ('" & TxBoxname.Text & _
            "','" & TxColumn.Text & _
            "','" & TxRow.Text & _
            "'," & ckAvailable.Checked & _
            ",'" & TxLocation.Text & _
            "'," & CInt(t) & _
            ",'" & TxDescription.Text & _
            "','" & TxSource.Text & _
            "','" & TxnguLDNA.Text & _
            "'," & CDbl(Tx260_280Ratio.Text) & _
            "," & CDbl(Tx230_260Ratio.Text) & _
            ",'" & TxEstimatedVolume.Text & _
            "','" & TxDate.Text & _
            "','" & TxPurificationMethod.Text & _
            "','" & TxKitUsed.Text & "')"




            Dim myCommand As New OleDb.OleDbCommand(strSQL, myConnection)
            myCommand.Connection = myConnection



            myCommand.ExecuteNonQuery()
            myCommand.Dispose()

            Init()

            Dim myCon As OleDb.OleDbConnection = New OleDb.OleDbConnection
            myCon.ConnectionString = strConn
            ' create a data adapter 
            Dim da As OleDb.OleDbDataAdapter = New OleDb.OleDbDataAdapter("Select * FROM GenomicDNA_Stocks ORDER BY ID", myConnection)

            ' create a new dataset 
            Dim ds As DataSet = New DataSet
            ' fill dataset 
            da.Fill(ds, "GenomicDNA_Stocks")

            ' write dataset contents to an xml file by calling WriteXml method 
            ' Attach DataSet to DataGrid

            DataGrid1.DataSource = ds.DefaultViewManager
            DataGrid1.ColumnHeadersVisible = True
            DataGrid1.Refresh()

            da.Dispose()
            ds.Dispose()
            myCon.Close()

        End If

        If Mode = 1 Then

            t = getID("tissues", "tissueID", "Description", cbTissue.Text)
            If Len(t) > 0 Then
                tissueID = CInt(t)
            End If

            strSQL = "UPDATE GenomicDNA_Stocks SET Boxname='" & TxBoxname.Text & _
            "',Column1='" & TxColumn.Text & _
            "',Row='" & TxRow.Text & _
            "',Available=" & ckAvailable.Checked & _
            ",Location='" & TxLocation.Text & _
            "',TissueID=" & CInt(t) & _
            ",Description='" & TxDescription.Text & _
            "',Source='" & TxSource.Text & _
            "',[ng/uLDNA]='" & TxnguLDNA.Text & _
            "',[260/280ratio]=" & CDbl(Tx260_280Ratio.Text) & _
            ",[230/260ratio]=" & CDbl(Tx230_260Ratio.Text) & _
            ",EstimatedVolume='" & TxEstimatedVolume.Text & _
            "',DateIsolate='" & TxDate.Text & _
            "',Comments='" & TxPurificationMethod.Text & _
            "',KitUsed='" & TxKitUsed.Text & "'" & _
            "  WHERE ID=" & ID

            'test


            Dim myCommand As New OleDb.OleDbCommand(strSQL)
            myCommand.Connection = myConnection
            myCommand.ExecuteNonQuery()

            DataGrid1.Item(DataGrid1.CurrentRowIndex, 0) = ID
            DataGrid1.Item(DataGrid1.CurrentRowIndex, 1) = TxBoxname.Text
            DataGrid1.Item(DataGrid1.CurrentRowIndex, 2) = TxColumn.Text
            DataGrid1.Item(DataGrid1.CurrentRowIndex, 3) = TxRow.Text
            DataGrid1.Item(DataGrid1.CurrentRowIndex, 4) = ckAvailable.Checked
            DataGrid1.Item(DataGrid1.CurrentRowIndex, 5) = TxLocation.Text


            DataGrid1.Item(DataGrid1.CurrentRowIndex, 6) = getID("tissues", "tissueID", "Description", cbTissue.Text)
            cbTissue.Items.Clear()
            FillComboBox(cbTissue, "Tissues", "Description")
            DataGrid1.Item(DataGrid1.CurrentRowIndex, 7) = TxDescription.Text
            DataGrid1.Item(DataGrid1.CurrentRowIndex, 8) = TxSource.Text
            DataGrid1.Item(DataGrid1.CurrentRowIndex, 9) = TxnguLDNA.Text
            DataGrid1.Item(DataGrid1.CurrentRowIndex, 10) = Tx260_280Ratio.Text
            DataGrid1.Item(DataGrid1.CurrentRowIndex, 11) = Tx230_260Ratio.Text

            DataGrid1.Item(DataGrid1.CurrentRowIndex, 12) = TxEstimatedVolume.Text
            DataGrid1.Item(DataGrid1.CurrentRowIndex, 13) = TxDate.Text
            DataGrid1.Item(DataGrid1.CurrentRowIndex, 14) = TxPurificationMethod.Text
            DataGrid1.Item(DataGrid1.CurrentRowIndex, 15) = TxKitUsed.Text

            myCommand.Dispose()

        End If

        myConnection.Close()
    End Sub

    Private Sub ButAdd_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButAdd.Click
        Dim t As String

        TxBoxname.Text = "Genomic DNA 2004-2005 Box #1"
        TxColumn.Text = ""
        TxRow.Text = ""
        ckAvailable.Checked = True
        TxLocation.Text = "Freeze #1 - 20C"


        cbTissue.Text = ""
        'cbTissue.Items.Clear()
        'FillComboBox(cbTissue, "Tissues", "Description")

        TxDescription.Text = ""
        TxSource.Text = ""
        TxnguLDNA.Text = ""
        Tx260_280Ratio.Text = "0"
        Tx230_260Ratio.Text = "0"

        TxEstimatedVolume.Text = ""
        TxDate.Text = ""
        TxPurificationMethod.Text = ""
        TxKitUsed.Text = "MoBio Ultra Clean Plant DNA Isolation Kit"
        TxBoxname.Focus()

        ButUpdate.Enabled = True
        ButDelete.Enabled = False
        Mode = 0

    End Sub
    Private Sub Flush()
        Dim t As String

        TxBoxname.Text = ""
        TxColumn.Text = ""
        TxRow.Text = ""
        ckAvailable.Checked = True

        TxLocation.Text = ""


        cbTissue.Text = ""

        TxDescription.Text = ""
        TxSource.Text = ""
        TxnguLDNA.Text = ""
        Tx260_280Ratio.Text = "0"
        Tx230_260Ratio.Text = "0"

        TxEstimatedVolume.Text = ""
        TxDate.Text = ""
        TxPurificationMethod.Text = ""
        TxKitUsed.Text = ""
        TxBoxname.Focus()


    End Sub
    Private Sub ShowToolTip()
        Dim toolTip1 As New ToolTip

        ' Set up the delays for the ToolTip.
        toolTip1.AutoPopDelay = 5000
        toolTip1.InitialDelay = 1000
        toolTip1.ReshowDelay = 500
        ' Force the ToolTip text to be displayed whether or not the form is active.
        toolTip1.ShowAlways = True

        ' Set up the ToolTip text for the Button and Checkbox.
        toolTip1.SetToolTip(Me.Label2, "Name of the box tissue is stored in")
        toolTip1.SetToolTip(Me.Label3, "Box column located in")
        toolTip1.SetToolTip(Me.Label4, "Box row located in")
        toolTip1.SetToolTip(Me.ckAvailable, "Check if the sample is available in the in storage. Remove checkmark whenever you use the last of a sample")
        toolTip1.SetToolTip(Me.Label7, "The tissue ID of the tissue DNA was isolated from. Use pull down menu")
        toolTip1.SetToolTip(Me.Label6, "Where preserved form is located (eg. Freeze #2)")
        toolTip1.SetToolTip(Me.Label8, "The description of the sample as it is writen on the sample label joined with an underscore to the autogenerated Genomic DNA ID")

        toolTip1.SetToolTip(Me.Label9, "The database tissue number corresponding to the sample this DNA was isolated from")
        toolTip1.SetToolTip(Me.Label10, "DNA concentration readings taken from the Nano-Drop Spectrophotometer")
        toolTip1.SetToolTip(Me.Label11, "readings taken from the Nano-Drop Spectrophotometer")
        toolTip1.SetToolTip(Me.Label12, "readings taken from the Nano-Drop Spectrophotometer")
        toolTip1.SetToolTip(Me.Label14, "volume of the sample in microliters (uL)")
        toolTip1.SetToolTip(Me.Label15, "Date the DNA was isolated")
        toolTip1.SetToolTip(Me.Label16, "which kit used to obtain DNA (ie. MoBio Plant DNA Isolation Kit)")
        toolTip1.SetToolTip(Me.Label17, "Any further information needed in this particular tissue sample")


    End Sub



    Private Sub ButDelete_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButDelete.Click
        On Error Resume Next
        Dim msg As String
        Dim title As String
        Dim style As MsgBoxStyle
        Dim response As MsgBoxResult
        msg = "Do you  really want to delete the Genomic DNA ID :" & ID & " ?"  ' Define message.
        style = MsgBoxStyle.DefaultButton2 Or _
           MsgBoxStyle.Critical Or MsgBoxStyle.YesNo
        title = "Delete Comfirmation"   ' Define title.
        ' Display message.
        response = MsgBox(msg, style, title)
        If response = MsgBoxResult.Yes Then   ' User chose Yes.

            strSQL = "DELETE FROM GenomicDNA_Stocks  WHERE ID=" & ID
            OpenConn()

            Dim myCommand As New OleDb.OleDbCommand(strSQL)
            myCommand.Connection = myConnection
            myCommand.ExecuteNonQuery()
            DataGrid1.Refresh()
            myCommand.Dispose()
            myConnection.Close()
            Load_GenomicDNA()
        Else
            ' Perform some other action.
        End If
    End Sub


    Private Sub DataGrid1_Navigate(ByVal sender As System.Object, ByVal ne As System.Windows.Forms.NavigateEventArgs) Handles DataGrid1.Navigate

    End Sub
End Class
