home *** CD-ROM | disk | FTP | other *** search
/ Master 95 #1 / MASTER95_1.iso / microsof / vbasic4 / vb4-6.cab / loginfrm.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1995-07-26  |  3.1 KB  |  112 lines

  1. VERSION 4.00
  2. Begin VB.Form frmLogin 
  3.    BorderStyle     =   3  'Fixed Double
  4.    Caption         =   "Login"
  5.    ClientHeight    =   1980
  6.    ClientLeft      =   2550
  7.    ClientTop       =   3330
  8.    ClientWidth     =   2820
  9.    Height          =   2385
  10.    HelpContextID   =   2016133
  11.    Icon            =   "LOGINFRM.frx":0000
  12.    Left            =   2490
  13.    LinkTopic       =   "Form1"
  14.    LockControls    =   -1  'True
  15.    ScaleHeight     =   1980
  16.    ScaleWidth      =   2820
  17.    Top             =   2985
  18.    Width           =   2940
  19.    Begin VB.CommandButton cmdCancel 
  20.       Cancel          =   -1  'True
  21.       Caption         =   "&Cancel"
  22.       Height          =   375
  23.       Left            =   1440
  24.       TabIndex        =   3
  25.       Top             =   1440
  26.       Width           =   1215
  27.    End
  28.    Begin VB.CommandButton cmdOK 
  29.       Caption         =   "&OK"
  30.       Default         =   -1  'True
  31.       Height          =   375
  32.       Left            =   120
  33.       TabIndex        =   2
  34.       Top             =   1440
  35.       Width           =   1215
  36.    End
  37.    Begin VB.TextBox txtPassword 
  38.       Height          =   285
  39.       Left            =   120
  40.       PasswordChar    =   "*"
  41.       TabIndex        =   1
  42.       Top             =   960
  43.       Width           =   2535
  44.    End
  45.    Begin VB.TextBox txtLoginName 
  46.       Height          =   285
  47.       Left            =   120
  48.       TabIndex        =   0
  49.       Top             =   360
  50.       Width           =   2535
  51.    End
  52.    Begin VB.Label lblLabels 
  53.       AutoSize        =   -1  'True
  54.       Caption         =   "Password: "
  55.       Height          =   195
  56.       Index           =   1
  57.       Left            =   120
  58.       TabIndex        =   5
  59.       Top             =   720
  60.       Width           =   780
  61.    End
  62.    Begin VB.Label lblLabels 
  63.       AutoSize        =   -1  'True
  64.       Caption         =   "Login Name: "
  65.       Height          =   195
  66.       Index           =   0
  67.       Left            =   120
  68.       TabIndex        =   4
  69.       Top             =   120
  70.       Width           =   945
  71.    End
  72. Attribute VB_Name = "frmLogin"
  73. Attribute VB_Creatable = False
  74. Attribute VB_Exposed = False
  75. Option Explicit
  76. Private Sub cmdCancel_Click()
  77.   On Error Resume Next
  78.   'if the global workspace object is not set, then we must be
  79.   'opening the app so we should end
  80.   If gwsMainWS Is Nothing Then
  81.     End
  82.   Else
  83.     'just unload since the workspace is already set
  84.     Unload Me
  85.   End If
  86. End Sub
  87. Private Sub Form_Load()
  88.   CenterMe Me, gnMDIFORM
  89. End Sub
  90. Private Sub cmdOK_Click()
  91.   On Error GoTo OKErr
  92.   Dim wsp As Workspace
  93.   Dim sTmp As String
  94.   DBEngine.DefaultUser = txtLoginName.Text
  95.   DBEngine.DefaultPassword = txtPassword.Text
  96.   Set wsp = DBEngine.CreateWorkspace("MainWS", txtLoginName.Text, txtPassword.Text)
  97.   'must have been successful so set the gswMainWS
  98.   Set gwsMainWS = wsp
  99.   Unload Me
  100.   Exit Sub
  101. OKErr:
  102.   MsgBox Error
  103.   txtLoginName.SetFocus
  104.   Exit Sub        'give them another chance
  105. End Sub
  106. Private Sub txtLoginName_GotFocus()
  107.   SendKeys "+{end}"
  108. End Sub
  109. Private Sub txtPassword_GotFocus()
  110.   SendKeys "+{end}"
  111. End Sub
  112.