Imports OracleInProcServer

Public Class frmLogonOO4O
    Inherits System.Windows.Forms.Form

#Region " Windows フォーム デザイナで生成されたコード "

    Public Sub New()
        MyBase.New()

        ' この呼び出しは Windows フォーム デザイナで必要です。
        InitializeComponent()

        ' InitializeComponent() 呼び出しの後に初期化を追加します。

    End Sub

    ' Form は dispose をオーバーライドしてコンポーネント一覧を消去します。
    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

    ' Windows フォーム デザイナで必要です。
    Private components As System.ComponentModel.IContainer

    ' メモ : 以下のプロシージャは、Windows フォーム デザイナで必要です。
    ' Windows フォーム デザイナを使って変更してください。  
    ' コード エディタは使用しないでください。
    Friend WithEvents lblUserID As System.Windows.Forms.Label
    Friend WithEvents txtUserID As System.Windows.Forms.TextBox
    Friend WithEvents txtPasswd As System.Windows.Forms.TextBox
    Friend WithEvents lblPasswd As System.Windows.Forms.Label
    Friend WithEvents txtService As System.Windows.Forms.TextBox
    Friend WithEvents lblService As System.Windows.Forms.Label
    Friend WithEvents cmdLogon As System.Windows.Forms.Button
    Friend WithEvents cmdCancel As System.Windows.Forms.Button
    <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
        Me.lblUserID = New System.Windows.Forms.Label()
        Me.txtUserID = New System.Windows.Forms.TextBox()
        Me.txtPasswd = New System.Windows.Forms.TextBox()
        Me.lblPasswd = New System.Windows.Forms.Label()
        Me.txtService = New System.Windows.Forms.TextBox()
        Me.lblService = New System.Windows.Forms.Label()
        Me.cmdLogon = New System.Windows.Forms.Button()
        Me.cmdCancel = New System.Windows.Forms.Button()
        Me.SuspendLayout()
        '
        'lblUserID
        '
        Me.lblUserID.Location = New System.Drawing.Point(24, 16)
        Me.lblUserID.Name = "lblUserID"
        Me.lblUserID.Size = New System.Drawing.Size(80, 16)
        Me.lblUserID.TabIndex = 0
        Me.lblUserID.Text = "ユーザID(&U):"
        Me.lblUserID.TextAlign = System.Drawing.ContentAlignment.MiddleLeft
        '
        'txtUserID
        '
        Me.txtUserID.Location = New System.Drawing.Point(104, 16)
        Me.txtUserID.Name = "txtUserID"
        Me.txtUserID.Size = New System.Drawing.Size(216, 19)
        Me.txtUserID.TabIndex = 1
        Me.txtUserID.Text = "txtUserID"
        '
        'txtPasswd
        '
        Me.txtPasswd.Location = New System.Drawing.Point(104, 48)
        Me.txtPasswd.Name = "txtPasswd"
        Me.txtPasswd.PasswordChar = Microsoft.VisualBasic.ChrW(42)
        Me.txtPasswd.Size = New System.Drawing.Size(216, 19)
        Me.txtPasswd.TabIndex = 3
        Me.txtPasswd.Text = "txtPasswd"
        '
        'lblPasswd
        '
        Me.lblPasswd.Location = New System.Drawing.Point(24, 48)
        Me.lblPasswd.Name = "lblPasswd"
        Me.lblPasswd.Size = New System.Drawing.Size(80, 16)
        Me.lblPasswd.TabIndex = 2
        Me.lblPasswd.Text = "パスワード(&P):"
        Me.lblPasswd.TextAlign = System.Drawing.ContentAlignment.MiddleLeft
        '
        'txtService
        '
        Me.txtService.Location = New System.Drawing.Point(104, 80)
        Me.txtService.Name = "txtService"
        Me.txtService.Size = New System.Drawing.Size(216, 19)
        Me.txtService.TabIndex = 5
        Me.txtService.Text = "txtService"
        '
        'lblService
        '
        Me.lblService.Location = New System.Drawing.Point(24, 80)
        Me.lblService.Name = "lblService"
        Me.lblService.Size = New System.Drawing.Size(80, 16)
        Me.lblService.TabIndex = 4
        Me.lblService.Text = "サービス(&S):"
        Me.lblService.TextAlign = System.Drawing.ContentAlignment.MiddleLeft
        '
        'cmdLogon
        '
        Me.cmdLogon.Location = New System.Drawing.Point(16, 120)
        Me.cmdLogon.Name = "cmdLogon"
        Me.cmdLogon.Size = New System.Drawing.Size(96, 24)
        Me.cmdLogon.TabIndex = 6
        Me.cmdLogon.Text = "ログオン(&L)"
        '
        'cmdCancel
        '
        Me.cmdCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel
        Me.cmdCancel.Location = New System.Drawing.Point(128, 120)
        Me.cmdCancel.Name = "cmdCancel"
        Me.cmdCancel.Size = New System.Drawing.Size(96, 24)
        Me.cmdCancel.TabIndex = 8
        Me.cmdCancel.Text = "取消(&C)"
        '
        'frmLogonOO4O
        '
        Me.AutoScaleBaseSize = New System.Drawing.Size(5, 12)
        Me.ClientSize = New System.Drawing.Size(354, 158)
        Me.Controls.AddRange(New System.Windows.Forms.Control() {Me.cmdCancel, Me.cmdLogon, Me.txtService, Me.lblService, Me.txtPasswd, Me.lblPasswd, Me.txtUserID, Me.lblUserID})
        Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog
        Me.Name = "frmLogonOO4O"
        Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent
        Me.Text = "Logon OO4O"
        Me.ResumeLayout(False)

    End Sub

#End Region


    Private Sub cmdLogon_Click(ByVal sender As System.Object, _
                               ByVal e As System.EventArgs) Handles cmdLogon.Click
        Dim strService As String = Me.txtService.Text.Trim
        Dim strConnect As String = Me.txtUserID.Text.Trim & "/" & _
                                   Me.txtPasswd.Text.Trim
        Dim intOpt As Integer
        Dim strErrText As String

        Try
            Me.Cursor = System.Windows.Forms.Cursors.WaitCursor()
            '
            p_oraSess = New OraSessionClass()
            '
            p_oraDb = p_oraSess.OpenDatabase(strService, _
                                             strConnect, _
                                             dbOption.ORADB_DEFAULT)
            Me.DialogResult = DialogResult.OK
            Me.Close()
        Catch
            strErrText = ErrorToString()
            MsgBox(strErrText, _
                   MsgBoxStyle.OKOnly + MsgBoxStyle.Exclamation, _
                   Me.Text)
        Finally
            Me.Cursor = System.Windows.Forms.Cursors.Default
        End Try
    End Sub
End Class
