All pastes #832035 Raw Edit

Someone

public text v1 · immutable
#832035 ·published 2007-12-25 18:44 UTC
rendered paste body
Option Explicit

Private Sub Cleanup()
    Unload Me
End Sub
Private Sub cmdCancelLogin_Click()
    Dim strResponse, strQuestion, strTitle As String
    
    strQuestion = "Are you sure you want to exit?"
    strTitle = "Before you go..."
    
    strResponse = MsgBox(strQuestion, vbYesNo, strTitle)
    
    If strResponse = vbYes Then
        Cleanup
    ElseIf strResponse = vbNo Then
        Exit Sub
    End If
    
End Sub

Private Sub Form_Initialize()
    Me.Left = ScaleWidth / 2
    Me.Top = ScaleHeight / 2
        
    ' Control Configuration
    
    cboUserLogin.AddItem "Guest"
    cboUserLogin.ListIndex = 0
    
    If Not cboUserLogin.ListIndex = 1 Then
        Dim strNewUser As String
        
        strNewUser = InputBox$("Enter your username you wish to use to sign in.", "New User", "NewUser")
        
        Select Case strNewUser
            Case vbNull
            Case "Guest": MsgBox "This username is reserved for Guest account only"
            Case Else
                cboUserLogin.AddItem strNewUser
                cboUserLogin.ListIndex = 1
        End Select
    End If
End Sub