home *** CD-ROM | disk | FTP | other *** search
/ Tools / WinSN5.0Ver.iso / PVb5.0 / VB / SAMPLES / VISDATA / LOGINFRM.FRM (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1997-01-12  |  4.1 KB  |  146 lines

  1. VERSION 5.00
  2. Begin VB.Form frmLogin 
  3.    BorderStyle     =   3  'Fixed Dialog
  4.    Caption         =   "
  5.    ClientHeight    =   1980
  6.    ClientLeft      =   2550
  7.    ClientTop       =   3330
  8.    ClientWidth     =   2820
  9.    BeginProperty Font 
  10.       Name            =   "
  11.       Size            =   9
  12.       Charset         =   134
  13.       Weight          =   400
  14.       Underline       =   0   'False
  15.       Italic          =   0   'False
  16.       Strikethrough   =   0   'False
  17.    EndProperty
  18.    HelpContextID   =   2016133
  19.    Icon            =   "Loginfrm.frx":0000
  20.    LinkTopic       =   "Form1"
  21.    LockControls    =   -1  'True
  22.    ScaleHeight     =   1980
  23.    ScaleWidth      =   2820
  24.    ShowInTaskbar   =   0   'False
  25.    StartUpPosition =   2  'CenterScreen
  26.    Begin VB.CommandButton cmdCancel 
  27.       Cancel          =   -1  'True
  28.       Caption         =   "
  29. (&C)"
  30.       Height          =   375
  31.       Left            =   1440
  32.       MaskColor       =   &H00000000&
  33.       TabIndex        =   3
  34.       Top             =   1440
  35.       Width           =   1215
  36.    End
  37.    Begin VB.CommandButton cmdOK 
  38.       Caption         =   "
  39. (&O)"
  40.       Default         =   -1  'True
  41.       Height          =   375
  42.       Left            =   120
  43.       MaskColor       =   &H00000000&
  44.       TabIndex        =   2
  45.       Top             =   1440
  46.       Width           =   1215
  47.    End
  48.    Begin VB.TextBox txtPassword 
  49.       Height          =   285
  50.       IMEMode         =   3  'DISABLE
  51.       Left            =   120
  52.       PasswordChar    =   "*"
  53.       TabIndex        =   1
  54.       Top             =   960
  55.       Width           =   2535
  56.    End
  57.    Begin VB.TextBox txtLoginName 
  58.       Height          =   285
  59.       Left            =   120
  60.       TabIndex        =   0
  61.       Top             =   360
  62.       Width           =   2535
  63.    End
  64.    Begin VB.Label lblLabels 
  65.       AutoSize        =   -1  'True
  66.       Caption         =   "
  67.       Height          =   195
  68.       Index           =   1
  69.       Left            =   120
  70.       TabIndex        =   5
  71.       Top             =   720
  72.       Width           =   795
  73.    End
  74.    Begin VB.Label lblLabels 
  75.       AutoSize        =   -1  'True
  76.       Caption         =   "
  77.       Height          =   195
  78.       Index           =   0
  79.       Left            =   120
  80.       TabIndex        =   4
  81.       Top             =   120
  82.       Width           =   930
  83.    End
  84. Attribute VB_Name = "frmLogin"
  85. Attribute VB_GlobalNameSpace = False
  86. Attribute VB_Creatable = False
  87. Attribute VB_PredeclaredId = True
  88. Attribute VB_Exposed = False
  89. Option Explicit
  90. '>>>>>>>>>>>>>>>>>>>>>>>>
  91. Const FORMCAPTION = "
  92. Const BUTTON1 = "
  93. (&O)"
  94. Const BUTTON2 = "
  95. (&C)"
  96. Const Label1 = "
  97. Const Label2 = "
  98. '>>>>>>>>>>>>>>>>>>>>>>>>
  99. Private Sub cmdCancel_Click()
  100.   On Error Resume Next
  101.   If gwsMainWS Is Nothing Then
  102.     End
  103.   Else
  104.     '
  105.     Unload Me
  106.   End If
  107. End Sub
  108. Private Sub Form_Load()
  109.   Me.Caption = FORMCAPTION
  110.   cmdOK.Caption = BUTTON1
  111.   cmdCancel.Caption = BUTTON2
  112.   lblLabels(0).Caption = Label1
  113.   lblLabels(1).Caption = Label2
  114. End Sub
  115. Private Sub cmdOK_Click()
  116.   On Error GoTo OKErr
  117.   Dim wsp As Workspace
  118.   Dim sTmp As String
  119.   If Not gwsMainWS Is Nothing Then
  120.     If UCase(txtLoginName.Text) = UCase(gwsMainWS.UserName) Then
  121.       '
  122.       Unload Me
  123.       Exit Sub
  124.     End If
  125.   End If
  126.   DBEngine.DefaultUser = txtLoginName.Text
  127.   DBEngine.DefaultPassword = txtPassword.Text
  128.   Set wsp = DBEngine.CreateWorkspace("MainWS", txtLoginName.Text, txtPassword.Text)
  129.  gswMainWS
  130.   Set gwsMainWS = wsp
  131.   Unload Me
  132.   Exit Sub
  133. OKErr:
  134.   MsgBox Error
  135.   txtLoginName.SetFocus
  136.   Exit Sub        '
  137. End Sub
  138. Private Sub txtLoginName_GotFocus()
  139.   txtLoginName.SelStart = 0
  140.   txtLoginName.SelLength = Len(txtLoginName.Text)
  141. End Sub
  142. Private Sub txtPassword_GotFocus()
  143.   txtPassword.SelStart = 0
  144.   txtPassword.SelLength = Len(txtPassword.Text)
  145. End Sub
  146.