Source code for MSQuant: frmSettings.vb, SqlInt/src/frmSettings.vb.

Table of contents page.

Home page for MSQuant.

'****************************************************************************
'* Copyright (C) 2004 Leonard James Foster                                  *
'* This file is part of CEBIsoftware.                                       *
'*                                                                          *
'* CEBIsoftware is distributed under the terms of                           *
'* the GNU General Public License. See src/COPYING.TXT or                   *
'* <http://www.gnu.org/licenses/gpl.txt> for details.                       *
'*                                                                          *
'* CEBIsoftware is free software; you can redistribute it                   *
'* and/or modify it under the terms of the GNU                              *
'* General Public License as published by the Free                          *
'* Software Foundation; either version 2 of the                             *
'* License, or (at your option) any later version.                          *
'*                                                                          *
'* CEBIsoftware is distributed in the hope that it will be                  *
'* useful, but WITHOUT ANY WARRANTY; without even the                       *
'* implied warranty of MERCHANTABILITY or FITNESS FOR                       *
'* A PARTICULAR PURPOSE.  See the GNU General Public                        *
'* License for more details.                                                *
'*                                                                          *
'* You should have received a copy of the GNU General                       *
'* Public License along with CEBIsoftware; if not, write to                 *
'* the Free Software Foundation, Inc., 59 Temple                            *
'* Place, Suite 330, Boston, MA  02111-1307  USA                            *
'*                                                                          *
'* Purpose: <to be filled in>.                                              *
'*                                                                          *
'****************************************************************************

'****************************************************************************
'*                               CEBI                                       *
'*                    Software Development Group                            *
'*                         Leonard James Foster                             *
'*                E-mail: NUKESPAMMERSdrmortensen@get2netZZZZZZ.dk          *
'*                 WWW: http://www.cebi.sdu.dk/                             *
'*                                                                          *
'*  Program for post-processing of result from search in mass               *
'*    spectrometric data.                                                   *
'*                                                                          *
'*    FILENAME:   frmSettings.vb                         *
'*    TYPE:  VISUAL_BASIC                                                   *
'*                                                                          *
'* CREATED: PM 2003-??-??   Vrs 1.0.                                        *
'* UPDATED: PM 2004-xx-xx                                                   *
'*                                                                          *
'****************************************************************************

Option Strict On
Option Explicit On


Public Class frmSettings
    Inherits System.Windows.Forms.Form
    Public LoginScript As String
    Structure ModList
        Dim ModName As String
        Dim VariableMod As Boolean
    End Structure
    Public DefAnalName As String = "Standard"
    Public MSTime As Decimal = 1
    Public MSMSTime As Decimal = 1
    Public MSperCycle As Integer = 4
    Public IDAThresh As Integer = 30
    Public VolLoad As Decimal = 2
    Public Spec As String = "Q1"
    Public LCNotes As String
    Public DefSeaName As String = "Standard"
    Public MSErr As Decimal = CDec(0.2)
    Public MSMSErr As Decimal = CDec(0.2)
    Public InstType As String = "ESI-QUAD-TOF"
    Public MissedCleav As Integer = 1
    Public SearchEngine As String = "Mascot"
    Public DBase As String = "IPI Human"
    Public Engine As String = "Mascot"
    Public Mods(8) As ModList

#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 tabSettings As System.Windows.Forms.TabControl
    Friend WithEvents tabSearchSettings As System.Windows.Forms.TabPage
    Friend WithEvents tabAnalysisSettings As System.Windows.Forms.TabPage
    Friend WithEvents GroupBox2 As System.Windows.Forms.GroupBox
    Friend WithEvents lblLC As System.Windows.Forms.Label
    Friend WithEvents rtbLC As System.Windows.Forms.RichTextBox
    Friend WithEvents txtAmount As System.Windows.Forms.TextBox
    Friend WithEvents lblAmount As System.Windows.Forms.Label
    Friend WithEvents GroupBox1 As System.Windows.Forms.GroupBox
    Friend WithEvents radQ1 As System.Windows.Forms.RadioButton
    Friend WithEvents radQ2 As System.Windows.Forms.RadioButton
    Friend WithEvents radFTMS As System.Windows.Forms.RadioButton
    Friend WithEvents lblMaxMSMS As System.Windows.Forms.Label
    Friend WithEvents lblMSMS As System.Windows.Forms.Label
    Friend WithEvents lblMS As System.Windows.Forms.Label
    Friend WithEvents txtMaxMSMS As System.Windows.Forms.TextBox
    Friend WithEvents txtMSMS As System.Windows.Forms.TextBox
    Friend WithEvents txtMS As System.Windows.Forms.TextBox
    Friend WithEvents txtThresh As System.Windows.Forms.TextBox
    Friend WithEvents lblThresh As System.Windows.Forms.Label
    Friend WithEvents bttnSave As System.Windows.Forms.Button
    Friend WithEvents Label1 As System.Windows.Forms.Label
    Friend WithEvents txtAnalName As System.Windows.Forms.TextBox
    Friend WithEvents lstboxDatabases As System.Windows.Forms.ListBox
    Friend WithEvents chklstFixed As System.Windows.Forms.CheckedListBox
    Friend WithEvents chklstVariable As System.Windows.Forms.CheckedListBox
    Friend WithEvents lblVariable As System.Windows.Forms.Label
    Friend WithEvents lblFixed As System.Windows.Forms.Label
    Friend WithEvents lblDatabase As System.Windows.Forms.Label
    Friend WithEvents lblName As System.Windows.Forms.Label
    Friend WithEvents txtName As System.Windows.Forms.TextBox
    Friend WithEvents grpboxSearchEngine As System.Windows.Forms.GroupBox
    Friend WithEvents radMascot As System.Windows.Forms.RadioButton
    Friend WithEvents radNext As System.Windows.Forms.RadioButton
    Friend WithEvents lblMissedCleav As System.Windows.Forms.Label
    Friend WithEvents lblInstrument As System.Windows.Forms.Label
    Friend WithEvents lblMSMSErr As System.Windows.Forms.Label
    Friend WithEvents lbMSErr As System.Windows.Forms.Label
    Friend WithEvents txtMissed As System.Windows.Forms.TextBox
    Friend WithEvents txtInstrument As System.Windows.Forms.TextBox
    Friend WithEvents txtMSMSErr As System.Windows.Forms.TextBox
    Friend WithEvents txtMSErr As System.Windows.Forms.TextBox
    Friend WithEvents SqlCEBI As System.Data.SqlClient.SqlConnection
    Friend WithEvents bttnClose As System.Windows.Forms.Button
    <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
        Me.tabSettings = New System.Windows.Forms.TabControl()
        Me.tabSearchSettings = New System.Windows.Forms.TabPage()
        Me.lstboxDatabases = New System.Windows.Forms.ListBox()
        Me.chklstFixed = New System.Windows.Forms.CheckedListBox()
        Me.chklstVariable = New System.Windows.Forms.CheckedListBox()
        Me.lblVariable = New System.Windows.Forms.Label()
        Me.lblFixed = New System.Windows.Forms.Label()
        Me.lblDatabase = New System.Windows.Forms.Label()
        Me.lblName = New System.Windows.Forms.Label()
        Me.txtName = New System.Windows.Forms.TextBox()
        Me.grpboxSearchEngine = New System.Windows.Forms.GroupBox()
        Me.radMascot = New System.Windows.Forms.RadioButton()
        Me.radNext = New System.Windows.Forms.RadioButton()
        Me.lblMissedCleav = New System.Windows.Forms.Label()
        Me.lblInstrument = New System.Windows.Forms.Label()
        Me.lblMSMSErr = New System.Windows.Forms.Label()
        Me.lbMSErr = New System.Windows.Forms.Label()
        Me.txtMissed = New System.Windows.Forms.TextBox()
        Me.txtInstrument = New System.Windows.Forms.TextBox()
        Me.txtMSMSErr = New System.Windows.Forms.TextBox()
        Me.txtMSErr = New System.Windows.Forms.TextBox()
        Me.tabAnalysisSettings = New System.Windows.Forms.TabPage()
        Me.Label1 = New System.Windows.Forms.Label()
        Me.txtAnalName = New System.Windows.Forms.TextBox()
        Me.lblThresh = New System.Windows.Forms.Label()
        Me.GroupBox2 = New System.Windows.Forms.GroupBox()
        Me.lblLC = New System.Windows.Forms.Label()
        Me.rtbLC = New System.Windows.Forms.RichTextBox()
        Me.txtAmount = New System.Windows.Forms.TextBox()
        Me.lblAmount = New System.Windows.Forms.Label()
        Me.GroupBox1 = New System.Windows.Forms.GroupBox()
        Me.radQ1 = New System.Windows.Forms.RadioButton()
        Me.radQ2 = New System.Windows.Forms.RadioButton()
        Me.radFTMS = New System.Windows.Forms.RadioButton()
        Me.lblMaxMSMS = New System.Windows.Forms.Label()
        Me.lblMSMS = New System.Windows.Forms.Label()
        Me.lblMS = New System.Windows.Forms.Label()
        Me.txtMaxMSMS = New System.Windows.Forms.TextBox()
        Me.txtMSMS = New System.Windows.Forms.TextBox()
        Me.txtMS = New System.Windows.Forms.TextBox()
        Me.txtThresh = New System.Windows.Forms.TextBox()
        Me.bttnClose = New System.Windows.Forms.Button()
        Me.bttnSave = New System.Windows.Forms.Button()
        Me.SqlCEBI = New System.Data.SqlClient.SqlConnection()
        Me.tabSettings.SuspendLayout()
        Me.tabSearchSettings.SuspendLayout()
        Me.grpboxSearchEngine.SuspendLayout()
        Me.tabAnalysisSettings.SuspendLayout()
        Me.GroupBox2.SuspendLayout()
        Me.GroupBox1.SuspendLayout()
        Me.SuspendLayout()
        '
        'tabSettings
        '
        Me.tabSettings.Controls.AddRange(New System.Windows.Forms.Control() {Me.tabSearchSettings, Me.tabAnalysisSettings})
        Me.tabSettings.Location = New System.Drawing.Point(16, 16)
        Me.tabSettings.Name = "tabSettings"
        Me.tabSettings.SelectedIndex = 0
        Me.tabSettings.Size = New System.Drawing.Size(752, 328)
        Me.tabSettings.TabIndex = 0
        '
        'tabSearchSettings
        '
        Me.tabSearchSettings.Controls.AddRange(New System.Windows.Forms.Control() {Me.lstboxDatabases, Me.chklstFixed, Me.chklstVariable, Me.lblVariable, Me.lblFixed, Me.lblDatabase, Me.lblName, Me.txtName, Me.grpboxSearchEngine, Me.lblMissedCleav, Me.lblInstrument, Me.lblMSMSErr, Me.lbMSErr, Me.txtMissed, Me.txtInstrument, Me.txtMSMSErr, Me.txtMSErr})
        Me.tabSearchSettings.Location = New System.Drawing.Point(4, 22)
        Me.tabSearchSettings.Name = "tabSearchSettings"
        Me.tabSearchSettings.Size = New System.Drawing.Size(744, 302)
        Me.tabSearchSettings.TabIndex = 0
        Me.tabSearchSettings.Text = "Searches"
        '
        'lstboxDatabases
        '
        Me.lstboxDatabases.Location = New System.Drawing.Point(592, 168)
        Me.lstboxDatabases.Name = "lstboxDatabases"
        Me.lstboxDatabases.Size = New System.Drawing.Size(128, 108)
        Me.lstboxDatabases.TabIndex = 66
        '
        'chklstFixed
        '
        Me.chklstFixed.CheckOnClick = True
        Me.chklstFixed.Location = New System.Drawing.Point(424, 40)
        Me.chklstFixed.Name = "chklstFixed"
        Me.chklstFixed.Size = New System.Drawing.Size(128, 94)
        Me.chklstFixed.TabIndex = 55
        '
        'chklstVariable
        '
        Me.chklstVariable.CheckOnClick = True
        Me.chklstVariable.Location = New System.Drawing.Point(592, 40)
        Me.chklstVariable.Name = "chklstVariable"
        Me.chklstVariable.Size = New System.Drawing.Size(128, 94)
        Me.chklstVariable.TabIndex = 54
        '
        'lblVariable
        '
        Me.lblVariable.Location = New System.Drawing.Point(592, 16)
        Me.lblVariable.Name = "lblVariable"
        Me.lblVariable.Size = New System.Drawing.Size(120, 16)
        Me.lblVariable.TabIndex = 65
        Me.lblVariable.Text = "Variable Modifications"
        '
        'lblFixed
        '
        Me.lblFixed.Location = New System.Drawing.Point(424, 16)
        Me.lblFixed.Name = "lblFixed"
        Me.lblFixed.Size = New System.Drawing.Size(104, 16)
        Me.lblFixed.TabIndex = 64
        Me.lblFixed.Text = "Fixed Modifications"
        '
        'lblDatabase
        '
        Me.lblDatabase.Location = New System.Drawing.Point(592, 144)
        Me.lblDatabase.Name = "lblDatabase"
        Me.lblDatabase.Size = New System.Drawing.Size(56, 23)
        Me.lblDatabase.TabIndex = 56
        Me.lblDatabase.Text = "Database"
        '
        'lblName
        '
        Me.lblName.Location = New System.Drawing.Point(72, 64)
        Me.lblName.Name = "lblName"
        Me.lblName.Size = New System.Drawing.Size(120, 23)
        Me.lblName.TabIndex = 49
        Me.lblName.Text = "Default Search Name"
        Me.lblName.TextAlign = System.Drawing.ContentAlignment.MiddleRight
        '
        'txtName
        '
        Me.txtName.Location = New System.Drawing.Point(200, 64)
        Me.txtName.Name = "txtName"
        Me.txtName.TabIndex = 58
        Me.txtName.Text = ""
        '
        'grpboxSearchEngine
        '
        Me.grpboxSearchEngine.Controls.AddRange(New System.Windows.Forms.Control() {Me.radMascot, Me.radNext})
        Me.grpboxSearchEngine.Location = New System.Drawing.Point(440, 176)
        Me.grpboxSearchEngine.Name = "grpboxSearchEngine"
        Me.grpboxSearchEngine.Size = New System.Drawing.Size(104, 80)
        Me.grpboxSearchEngine.TabIndex = 48
        Me.grpboxSearchEngine.TabStop = False
        Me.grpboxSearchEngine.Text = "Search Engine"
        '
        'radMascot
        '
        Me.radMascot.Location = New System.Drawing.Point(16, 24)
        Me.radMascot.Name = "radMascot"
        Me.radMascot.Size = New System.Drawing.Size(72, 24)
        Me.radMascot.TabIndex = 0
        Me.radMascot.Text = "Mascot"
        '
        'radNext
        '
        Me.radNext.Location = New System.Drawing.Point(16, 48)
        Me.radNext.Name = "radNext"
        Me.radNext.Size = New System.Drawing.Size(72, 24)
        Me.radNext.TabIndex = 0
        Me.radNext.Text = "Other"
        '
        'lblMissedCleav
        '
        Me.lblMissedCleav.Location = New System.Drawing.Point(88, 192)
        Me.lblMissedCleav.Name = "lblMissedCleav"
        Me.lblMissedCleav.Size = New System.Drawing.Size(104, 23)
        Me.lblMissedCleav.TabIndex = 50
        Me.lblMissedCleav.Text = "Missed cleavages"
        Me.lblMissedCleav.TextAlign = System.Drawing.ContentAlignment.MiddleRight
        '
        'lblInstrument
        '
        Me.lblInstrument.Location = New System.Drawing.Point(88, 160)
        Me.lblInstrument.Name = "lblInstrument"
        Me.lblInstrument.TabIndex = 53
        Me.lblInstrument.Text = "Instrument Type"
        Me.lblInstrument.TextAlign = System.Drawing.ContentAlignment.MiddleRight
        '
        'lblMSMSErr
        '
        Me.lblMSMSErr.Location = New System.Drawing.Point(88, 128)
        Me.lblMSMSErr.Name = "lblMSMSErr"
        Me.lblMSMSErr.TabIndex = 52
        Me.lblMSMSErr.Text = "MS/MS error (Th)"
        Me.lblMSMSErr.TextAlign = System.Drawing.ContentAlignment.MiddleRight
        '
        'lbMSErr
        '
        Me.lbMSErr.Location = New System.Drawing.Point(104, 96)
        Me.lbMSErr.Name = "lbMSErr"
        Me.lbMSErr.Size = New System.Drawing.Size(88, 23)
        Me.lbMSErr.TabIndex = 51
        Me.lbMSErr.Text = "MS Error (Th)"
        Me.lbMSErr.TextAlign = System.Drawing.ContentAlignment.MiddleRight
        '
        'txtMissed
        '
        Me.txtMissed.Location = New System.Drawing.Point(200, 192)
        Me.txtMissed.Name = "txtMissed"
        Me.txtMissed.Size = New System.Drawing.Size(32, 20)
        Me.txtMissed.TabIndex = 63
        Me.txtMissed.Text = ""
        '
        'txtInstrument
        '
        Me.txtInstrument.Location = New System.Drawing.Point(200, 160)
        Me.txtInstrument.Name = "txtInstrument"
        Me.txtInstrument.Size = New System.Drawing.Size(152, 20)
        Me.txtInstrument.TabIndex = 62
        Me.txtInstrument.Text = ""
        '
        'txtMSMSErr
        '
        Me.txtMSMSErr.Location = New System.Drawing.Point(200, 128)
        Me.txtMSMSErr.Name = "txtMSMSErr"
        Me.txtMSMSErr.Size = New System.Drawing.Size(32, 20)
        Me.txtMSMSErr.TabIndex = 61
        Me.txtMSMSErr.Text = ""
        '
        'txtMSErr
        '
        Me.txtMSErr.Location = New System.Drawing.Point(200, 96)
        Me.txtMSErr.Name = "txtMSErr"
        Me.txtMSErr.Size = New System.Drawing.Size(32, 20)
        Me.txtMSErr.TabIndex = 60
        Me.txtMSErr.Text = ""
        '
        'tabAnalysisSettings
        '
        Me.tabAnalysisSettings.Controls.AddRange(New System.Windows.Forms.Control() {Me.Label1, Me.txtAnalName, Me.lblThresh, Me.GroupBox2, Me.GroupBox1, Me.lblMaxMSMS, Me.lblMSMS, Me.lblMS, Me.txtMaxMSMS, Me.txtMSMS, Me.txtMS, Me.txtThresh})
        Me.tabAnalysisSettings.Location = New System.Drawing.Point(4, 22)
        Me.tabAnalysisSettings.Name = "tabAnalysisSettings"
        Me.tabAnalysisSettings.Size = New System.Drawing.Size(744, 302)
        Me.tabAnalysisSettings.TabIndex = 1
        Me.tabAnalysisSettings.Text = "Analyses"
        '
        'Label1
        '
        Me.Label1.Location = New System.Drawing.Point(24, 24)
        Me.Label1.Name = "Label1"
        Me.Label1.Size = New System.Drawing.Size(120, 23)
        Me.Label1.TabIndex = 51
        Me.Label1.Text = "Default analysis name"
        Me.Label1.TextAlign = System.Drawing.ContentAlignment.MiddleRight
        '
        'txtAnalName
        '
        Me.txtAnalName.Location = New System.Drawing.Point(152, 24)
        Me.txtAnalName.Name = "txtAnalName"
        Me.txtAnalName.Size = New System.Drawing.Size(128, 20)
        Me.txtAnalName.TabIndex = 50
        Me.txtAnalName.Text = ""
        '
        'lblThresh
        '
        Me.lblThresh.Location = New System.Drawing.Point(24, 56)
        Me.lblThresh.Name = "lblThresh"
        Me.lblThresh.Size = New System.Drawing.Size(120, 23)
        Me.lblThresh.TabIndex = 49
        Me.lblThresh.Text = "Peak threshold (cps)"
        Me.lblThresh.TextAlign = System.Drawing.ContentAlignment.MiddleRight
        '
        'GroupBox2
        '
        Me.GroupBox2.Controls.AddRange(New System.Windows.Forms.Control() {Me.lblLC, Me.rtbLC, Me.txtAmount, Me.lblAmount})
        Me.GroupBox2.Location = New System.Drawing.Point(376, 24)
        Me.GroupBox2.Name = "GroupBox2"
        Me.GroupBox2.Size = New System.Drawing.Size(344, 152)
        Me.GroupBox2.TabIndex = 48
        Me.GroupBox2.TabStop = False
        Me.GroupBox2.Text = "Liquid chromatography"
        '
        'lblLC
        '
        Me.lblLC.Location = New System.Drawing.Point(8, 48)
        Me.lblLC.Name = "lblLC"
        Me.lblLC.Size = New System.Drawing.Size(64, 23)
        Me.lblLC.TabIndex = 34
        Me.lblLC.Text = "LC details"
        Me.lblLC.TextAlign = System.Drawing.ContentAlignment.MiddleRight
        '
        'rtbLC
        '
        Me.rtbLC.Location = New System.Drawing.Point(80, 48)
        Me.rtbLC.Name = "rtbLC"
        Me.rtbLC.Size = New System.Drawing.Size(248, 88)
        Me.rtbLC.TabIndex = 25
        Me.rtbLC.Text = ""
        '
        'txtAmount
        '
        Me.txtAmount.Location = New System.Drawing.Point(120, 24)
        Me.txtAmount.Name = "txtAmount"
        Me.txtAmount.Size = New System.Drawing.Size(32, 20)
        Me.txtAmount.TabIndex = 16
        Me.txtAmount.Text = ""
        '
        'lblAmount
        '
        Me.lblAmount.Location = New System.Drawing.Point(8, 24)
        Me.lblAmount.Name = "lblAmount"
        Me.lblAmount.Size = New System.Drawing.Size(112, 23)
        Me.lblAmount.TabIndex = 27
        Me.lblAmount.Text = "Volume loaded (µL)"
        Me.lblAmount.TextAlign = System.Drawing.ContentAlignment.MiddleRight
        '
        'GroupBox1
        '
        Me.GroupBox1.Controls.AddRange(New System.Windows.Forms.Control() {Me.radQ1, Me.radQ2, Me.radFTMS})
        Me.GroupBox1.Location = New System.Drawing.Point(208, 72)
        Me.GroupBox1.Name = "GroupBox1"
        Me.GroupBox1.Size = New System.Drawing.Size(136, 104)
        Me.GroupBox1.TabIndex = 47
        Me.GroupBox1.TabStop = False
        Me.GroupBox1.Text = "Spectrometer"
        '
        'radQ1
        '
        Me.radQ1.Location = New System.Drawing.Point(16, 24)
        Me.radQ1.Name = "radQ1"
        Me.radQ1.TabIndex = 17
        Me.radQ1.Text = "QSTAR1"
        '
        'radQ2
        '
        Me.radQ2.Location = New System.Drawing.Point(16, 48)
        Me.radQ2.Name = "radQ2"
        Me.radQ2.TabIndex = 18
        Me.radQ2.Text = "QSTAR2xl"
        '
        'radFTMS
        '
        Me.radFTMS.Location = New System.Drawing.Point(16, 72)
        Me.radFTMS.Name = "radFTMS"
        Me.radFTMS.TabIndex = 19
        Me.radFTMS.Text = "Kickass FTMS"
        '
        'lblMaxMSMS
        '
        Me.lblMaxMSMS.Location = New System.Drawing.Point(8, 152)
        Me.lblMaxMSMS.Name = "lblMaxMSMS"
        Me.lblMaxMSMS.Size = New System.Drawing.Size(136, 23)
        Me.lblMaxMSMS.TabIndex = 46
        Me.lblMaxMSMS.Text = "Max MS/MS per cycle"
        Me.lblMaxMSMS.TextAlign = System.Drawing.ContentAlignment.MiddleRight
        '
        'lblMSMS
        '
        Me.lblMSMS.Location = New System.Drawing.Point(40, 120)
        Me.lblMSMS.Name = "lblMSMS"
        Me.lblMSMS.TabIndex = 45
        Me.lblMSMS.Text = "MS/MS time (s)"
        Me.lblMSMS.TextAlign = System.Drawing.ContentAlignment.MiddleRight
        '
        'lblMS
        '
        Me.lblMS.Location = New System.Drawing.Point(40, 88)
        Me.lblMS.Name = "lblMS"
        Me.lblMS.TabIndex = 44
        Me.lblMS.Text = "MS time (s)"
        Me.lblMS.TextAlign = System.Drawing.ContentAlignment.MiddleRight
        '
        'txtMaxMSMS
        '
        Me.txtMaxMSMS.Location = New System.Drawing.Point(152, 152)
        Me.txtMaxMSMS.Name = "txtMaxMSMS"
        Me.txtMaxMSMS.Size = New System.Drawing.Size(32, 20)
        Me.txtMaxMSMS.TabIndex = 43
        Me.txtMaxMSMS.Text = ""
        '
        'txtMSMS
        '
        Me.txtMSMS.Location = New System.Drawing.Point(152, 120)
        Me.txtMSMS.Name = "txtMSMS"
        Me.txtMSMS.Size = New System.Drawing.Size(32, 20)
        Me.txtMSMS.TabIndex = 42
        Me.txtMSMS.Text = ""
        '
        'txtMS
        '
        Me.txtMS.Location = New System.Drawing.Point(152, 88)
        Me.txtMS.Name = "txtMS"
        Me.txtMS.Size = New System.Drawing.Size(32, 20)
        Me.txtMS.TabIndex = 41
        Me.txtMS.Text = ""
        '
        'txtThresh
        '
        Me.txtThresh.Location = New System.Drawing.Point(152, 56)
        Me.txtThresh.Name = "txtThresh"
        Me.txtThresh.Size = New System.Drawing.Size(32, 20)
        Me.txtThresh.TabIndex = 40
        Me.txtThresh.Text = ""
        '
        'bttnClose
        '
        Me.bttnClose.Location = New System.Drawing.Point(688, 368)
        Me.bttnClose.Name = "bttnClose"
        Me.bttnClose.Size = New System.Drawing.Size(80, 24)
        Me.bttnClose.TabIndex = 23
        Me.bttnClose.Text = "Close"
        '
        'bttnSave
        '
        Me.bttnSave.Location = New System.Drawing.Point(560, 368)
        Me.bttnSave.Name = "bttnSave"
        Me.bttnSave.Size = New System.Drawing.Size(104, 24)
        Me.bttnSave.TabIndex = 24
        Me.bttnSave.Text = "Save options"
        '
        'SqlCEBI
        '
        Me.SqlCEBI.ConnectionString = "data source=PILSCANNER;initial catalog=LFtest;password=lfoster;persist security i" & _
        "nfo=True;user id=leonard;workstation id=LEONARD;packet size=4096; Connect Timeout=3000"
        '
        'frmSettings
        '
        Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
        Me.ClientSize = New System.Drawing.Size(808, 421)
        Me.Controls.AddRange(New System.Windows.Forms.Control() {Me.bttnSave, Me.bttnClose, Me.tabSettings})
        Me.Name = "frmSettings"
        Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent
        Me.Text = "Settings"
        Me.tabSettings.ResumeLayout(False)
        Me.tabSearchSettings.ResumeLayout(False)
        Me.grpboxSearchEngine.ResumeLayout(False)
        Me.tabAnalysisSettings.ResumeLayout(False)
        Me.GroupBox2.ResumeLayout(False)
        Me.GroupBox1.ResumeLayout(False)
        Me.ResumeLayout(False)

    End Sub

#End Region


    '****************************************************************************
    '*    <placeholder for header>                                              *
    '****************************************************************************
    Private Sub bttnClose_Click(ByVal aSender As System.Object, _
      ByVal anEvent As System.EventArgs) _
      Handles bttnClose.Click

        Me.Close()
    End Sub 'bttnClose_Click


    '****************************************************************************
    '*    <placeholder for header>                                              *
    '****************************************************************************
    Private Sub frmSettings_Load(ByVal aSender As System.Object, _
      ByVal anEvent As System.EventArgs) _
      Handles MyBase.Load

        chklstFixed.Items.Clear()
        chklstVariable.Items.Clear()
        lstboxDatabases.Items.Clear()

        'Call the LoadSettings sub to retrieve the saved settings
        Dim PathName As String = DataExportFunctions.GetBaseDir
        If IO.File.Exists(PathName + "dbOptions.xml") Then
            LoadSettings()
        Else
            Dim Counter As Integer
            For Counter = 1 To 8
                Mods(Counter).ModName = "No modification"
                Mods(Counter).VariableMod = False
            Next
        End If

        'Open the database and get the available projects to fill the Projects list box
        SqlCEBI.ConnectionString = LoginScript
        Dim mySelectQuery As String = "SELECT ModName FROM Modifications ORDER BY ModName ASC"
        Dim myCommand As New SqlClient.SqlCommand(CStr(mySelectQuery), SqlCEBI)
        myCommand.Connection.Open()
        Dim myDataReader As SqlClient.SqlDataReader = myCommand.ExecuteReader(CommandBehavior.CloseConnection)
        While myDataReader.Read()
            If Not myDataReader.GetSqlString(0).ToString.TrimEnd(Nothing) = "No modification" Then
                chklstFixed.Items.Add(myDataReader.GetSqlString(0).ToString)
                chklstVariable.Items.Add(myDataReader.GetSqlString(0).ToString)
            End If
        End While
        myCommand.Connection.Close()

        'Get the current DBase list and fill the Database list box
        mySelectQuery = "SELECT DBase FROM Databases ORDER BY DBase ASC"
        Dim myCommand2 As New SqlClient.SqlCommand(CStr(mySelectQuery), SqlCEBI)
        myCommand2.Connection.Open()
        myDataReader = myCommand2.ExecuteReader(CommandBehavior.CloseConnection)
        While myDataReader.Read()
            lstboxDatabases.Items.Add(myDataReader.GetSqlString(0).ToString)
        End While
        myCommand2.Connection.Close()
        lstboxDatabases.SelectedIndex = 0

        'Enter the default Analysis values
        txtAnalName.Text = DefAnalName
        txtAmount.Text = VolLoad.ToString
        txtMaxMSMS.Text = MSperCycle.ToString
        txtMS.Text = MSTime.ToString
        txtMSMS.Text = MSMSTime.ToString
        txtThresh.Text = IDAThresh.ToString
        radFTMS.Checked = False
        radQ1.Checked = False
        radQ2.Checked = False
        If Spec = "QSTAR1" Then
            radQ1.Checked = True
        ElseIf Spec = "QSTAR2" Then
            radQ2.Checked = True
        ElseIf Spec = "FTMS" Then
            radFTMS.Checked = True
        End If
        rtbLC.Text = LCNotes

        'Enter the default Search Values
        txtName.Text = DefSeaName
        txtMSErr.Text = MSErr.ToString
        txtMSMSErr.Text = MSMSErr.ToString
        txtInstrument.Text = InstType
        txtMissed.Text = MissedCleav.ToString
        If Engine = "Mascot" Then
            radMascot.Checked = True
            radNext.Checked = False
        Else
            radMascot.Checked = False
            radNext.Checked = True
        End If
        lstboxDatabases.SelectedIndex = lstboxDatabases.FindString(DBase)
        Dim ModNum As Integer
        For ModNum = 1 To 8
            If Not Mods(ModNum).ModName.TrimEnd(Nothing) = "No modification" Then
                If Not Mods(ModNum).VariableMod Then
                    chklstFixed.SetItemCheckState(chklstFixed.FindString(Mods(ModNum).ModName), CheckState.Checked)
                Else
                    chklstVariable.SetItemCheckState(chklstVariable.FindString(Mods(ModNum).ModName), CheckState.Checked)
                End If
            End If
        Next

        Me.Activate()
    End Sub 'frmSettings_Load


    '****************************************************************************
    '*    <placeholder for header>                                              *
    '****************************************************************************
    Private Function StrToBool(ByRef aInToConvert As String) As Boolean

        Dim toReturn As Boolean = False
        Select Case aInToConvert
            Case "0"
                toReturn = False
            Case "1"
                toReturn = True
            Case Else
                MsgBox("An unexpected value was encountered in the Variable modification fields in the dbOptions.xml file. Please report this problem to the developer.", MsgBoxStyle.Exclamation)
        End Select

        Return toReturn
    End Function 'StrToBool


    '****************************************************************************
    '*    <placeholder for header>                                              *
    '****************************************************************************
    Private Function BoolToStr(ByVal ToConvert As Boolean) As String

        Dim toReturn As String = "0"
        If ToConvert = True Then
            BoolToStr = "1"
        End If

        'Changed PM_VS2005_SERIOUS 2006-06-15
        Return toReturn
    End Function


    '****************************************************************************
    '*    <placeholder for header>                                              *
    '****************************************************************************
    Private Sub LoadSettings()
        Dim Counter As Integer
        Dim PathName As String = DataExportFunctions.GetBaseDir
        Dim PrefFile As Xml.XmlTextReader = New Xml.XmlTextReader(PathName + "dbOptions.xml")
        While PrefFile.Read()
            Select Case (PrefFile.NodeType)
                Case Xml.XmlNodeType.Text
                    Counter = Counter + 1
                    If Counter = 1 Then
                        DefSeaName = PrefFile.Value
                    End If
                    If Counter = 2 Then
                        If PrefFile.Value <> "4096" Then
                            MSErr = CDec(PrefFile.Value)
                        Else
                            MSErr = 0
                        End If
                    End If
                    If Counter = 3 Then
                        If PrefFile.Value <> "4096" Then
                            MSMSErr = CDec(PrefFile.Value)
                        Else
                            MSMSErr = 0
                        End If
                    End If
                    If Counter = 4 Then
                        If PrefFile.Value <> "4096" Then
                            InstType = PrefFile.Value
                        Else
                            InstType = ""
                        End If
                    End If
                    If Counter = 5 Then
                        If PrefFile.Value <> "4096" Then
                            MissedCleav = CInt(PrefFile.Value)
                        Else
                            MissedCleav = 0
                        End If
                    End If
                    If Counter = 6 Then
                        DBase = PrefFile.Value
                    End If
                    If Counter = 7 Then
                        Engine = PrefFile.Value
                    End If
                    If Counter = 8 Then
                        Mods(1).ModName = PrefFile.Value
                    End If
                    If Counter = 9 Then
                        Mods(1).VariableMod = StrToBool(PrefFile.Value)
                    End If
                    If Counter = 10 Then
                        Mods(2).ModName = PrefFile.Value
                    End If
                    If Counter = 11 Then
                        Mods(2).VariableMod = StrToBool(PrefFile.Value)
                    End If
                    If Counter = 12 Then
                        Mods(3).ModName = PrefFile.Value
                    End If
                    If Counter = 13 Then
                        Mods(3).VariableMod = StrToBool(PrefFile.Value)
                    End If
                    If Counter = 14 Then
                        Mods(4).ModName = PrefFile.Value
                    End If
                    If Counter = 15 Then
                        Mods(4).VariableMod = StrToBool(PrefFile.Value)
                    End If
                    If Counter = 16 Then
                        Mods(5).ModName = PrefFile.Value
                    End If
                    If Counter = 17 Then
                        Mods(5).VariableMod = StrToBool(PrefFile.Value)
                    End If
                    If Counter = 18 Then
                        Mods(6).ModName = PrefFile.Value
                    End If
                    If Counter = 19 Then
                        Mods(6).VariableMod = StrToBool(PrefFile.Value)
                    End If
                    If Counter = 20 Then
                        Mods(7).ModName = PrefFile.Value
                    End If
                    If Counter = 21 Then
                        Mods(7).VariableMod = StrToBool(PrefFile.Value)
                    End If
                    If Counter = 22 Then
                        Mods(8).ModName = PrefFile.Value
                    End If
                    If Counter = 23 Then
                        Mods(8).VariableMod = StrToBool(PrefFile.Value)
                    End If
                    If Counter = 24 Then
                        DefAnalName = PrefFile.Value
                    End If
                    If Counter = 25 Then
                        If PrefFile.Value <> "4096" Then
                            IDAThresh = CInt(PrefFile.Value)
                        Else
                            IDAThresh = 0
                        End If
                    End If
                    If Counter = 26 Then
                        If PrefFile.Value <> "4096" Then
                            MSTime = CDec(PrefFile.Value)
                        Else
                            MSTime = 0
                        End If
                    End If
                    If Counter = 27 Then
                        If PrefFile.Value <> "4096" Then
                            MSMSTime = CDec(PrefFile.Value)
                        Else
                            MSMSTime = 0
                        End If
                    End If
                    If Counter = 28 Then
                        If PrefFile.Value <> "4096" Then
                            MSperCycle = CInt(PrefFile.Value)
                        Else
                            MSperCycle = 0
                        End If
                    End If
                    If Counter = 29 Then
                        If Spec = "Q1" Then
                            Spec = "QSTAR1"
                        ElseIf Spec = "Q2" Then
                            Spec = "QSTAR2"
                        ElseIf Spec = "FTMS" Then
                            Spec = "FTMS"
                        End If
                    End If
                    If Counter = 30 Then
                        If PrefFile.Value <> "4096" Then
                            VolLoad = CDec(PrefFile.Value)
                        Else
                            VolLoad = 0
                        End If
                    End If
                    If Counter = 31 Then
                        If PrefFile.Value <> "4096" Then
                            LCNotes = PrefFile.Value
                        Else
                            LCNotes = ""
                        End If
                    End If
            End Select
        End While
        PrefFile.Close()
    End Sub


    '****************************************************************************
    '*    <placeholder for header>                                              *
    '****************************************************************************
    Private Sub bttnSave_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles bttnSave.Click
        Dim Counter As Integer
        Dim ModNum As Integer = 0

        'Set all the strings in the ModList to spaces equal to an empty record in the database
        For Counter = 1 To 8
            Mods(Counter).ModName = "No modification     "
            Mods(Counter).VariableMod = False
        Next

        'Get the list of Fixed mods
        For Counter = 0 To (chklstFixed.Items.Count - 1)
            If chklstFixed.GetItemCheckState(Counter) = CheckState.Checked Then
                ModNum = ModNum + 1
                Mods(ModNum).ModName = CStr(chklstFixed.Items.Item(Counter))
                Mods(ModNum).VariableMod = False
            End If
        Next

        'Get the list of Variable mods
        For Counter = 0 To (chklstVariable.Items.Count - 1)
            If chklstVariable.GetItemCheckState(Counter) = CheckState.Checked Then
                ModNum = ModNum + 1
                Mods(ModNum).ModName = CStr(chklstVariable.Items.Item(Counter))
                Mods(ModNum).VariableMod = True
            End If
        Next

        'Check that all settings have a non-null value. If null then replace with a marker
        If txtName.Text.TrimEnd(Nothing) = "" Or txtAnalName.Text.TrimEnd(Nothing) = "" Then
            MsgBox("Default names for searches and analyses must have values!", MsgBoxStyle.Exclamation)
        End If

        Dim Thresh As Integer
        If txtThresh.Text.TrimEnd(Nothing) = "" Then
            Thresh = 4096
        Else
            Thresh = CInt(txtThresh.Text)
        End If

        Dim SaveMSErr As Decimal
        If txtMSErr.Text.TrimEnd(Nothing) = "" Then
            SaveMSErr = 4096
        Else
            SaveMSErr = CDec(txtMSErr.Text)
        End If

        Dim SaveMSMSErr As Decimal
        If txtMSMSErr.Text.TrimEnd(Nothing) = "" Then
            SaveMSMSErr = 4096
        Else
            SaveMSMSErr = CDec(txtMSMSErr.Text)
        End If

        Dim SaveMSMS As Decimal
        If txtMSMS.Text.TrimEnd(Nothing) = "" Then
            SaveMSMS = 4096
        Else
            SaveMSMS = CDec(txtMSMS.Text)
        End If

        Dim SaveMS As Decimal
        If txtMS.Text.TrimEnd(Nothing) = "" Then
            SaveMS = 4096
        Else
            SaveMS = CDec(txtMS.Text)
        End If

        Dim SaveMaxMSMS As Integer
        If txtMaxMSMS.Text.TrimEnd(Nothing) = "" Then
            SaveMaxMSMS = 4096
        Else
            SaveMaxMSMS = CInt(txtMaxMSMS.Text)
        End If

        Dim SaveMiss As Integer
        If txtMissed.Text.TrimEnd(Nothing) = "" Then
            SaveMiss = 4096
        Else
            SaveMiss = CInt(txtMissed.Text)
        End If

        Dim SaveAmt As Decimal
        If txtAmount.Text.TrimEnd(Nothing) = "" Then
            SaveAmt = 4096
        Else
            SaveAmt = CDec(txtAmount.Text)
        End If

        Dim SaveNotes As String
        If rtbLC.Text.TrimEnd(Nothing) = "" Then
            SaveNotes = "4096"
        Else
            SaveNotes = rtbLC.Text
        End If

        Dim SaveInst As String
        If txtInstrument.Text.TrimEnd(Nothing) = "" Then
            SaveInst = "4096"
        Else
            SaveInst = txtInstrument.Text
        End If

        Dim PathName As String = DataExportFunctions.GetBaseDir

        Dim PrefFile As Xml.XmlTextWriter = New Xml.XmlTextWriter(PathName + "dbOptions.xml", Nothing)
        With PrefFile
            .Formatting = Xml.Formatting.Indented
            .WriteStartDocument(False)
            .WriteComment("CEBI database options  ")
            .WriteStartElement("Options")
            .WriteElementString("DefaultName", txtName.Text)
            .WriteElementString("MSError", SaveMSErr.ToString)
            .WriteElementString("MSMSError", SaveMSMSErr.ToString)
            .WriteElementString("InstType", SaveInst)
            .WriteElementString("MissedCleavages", SaveMiss.ToString)
            .WriteElementString("Database", CStr(lstboxDatabases.SelectedItem))
            If radMascot.Checked Then
                .WriteElementString("Engine", "Mascot")
            Else
                .WriteElementString("Engine", "Other")
            End If
            For ModNum = 1 To 8
                .WriteElementString("Mod" + ModNum.ToString, Mods(ModNum).ModName)
                .WriteElementString("Var" + ModNum.ToString, BoolToStr(Mods(ModNum).VariableMod))
            Next
            .WriteElementString("AnalName", txtAnalName.Text)
            .WriteElementString("IDAThresh", Thresh.ToString)
            .WriteElementString("MSTime", SaveMS.ToString)
            .WriteElementString("MSMSTime", SaveMSMS.ToString)
            .WriteElementString("MaxMSMS", SaveMaxMSMS.ToString)
            If radQ1.Checked Then
                .WriteElementString("Spec", "Q1")
            ElseIf radQ2.Checked Then
                .WriteElementString("Spec", "Q2")
            ElseIf radFTMS.Checked Then
                .WriteElementString("Spec", "FTMS")
            End If
            .WriteElementString("Volume", SaveAmt.ToString)
            .WriteElementString("LCNotes", SaveNotes)
            .WriteEndElement()
            .Flush()
            .Close()
        End With
    End Sub

End Class 'frmSettings


    

    

Generated by script codePublish.pl at 2009-01-05T15:20:59.