home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   comp.lang.visual.basic      MS Visual Basic discussions, NOT dot-net      10,840 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 9,705 of 10,840   
   Mike to All   
   Re: Login for a password form...multiple   
   25 Oct 05 09:57:45   
   
   From: mbergerNO@SPAMskypoint.com   
      
   If this is your exact code, you have problems all over the place..   
      
   Your Select Case does not have a matching End Select   
      
   Also, you have 2 variables   
   - A module level variable called LoginSucceeded   
   - A procdure level variable called LoginSucceded   
   You are just asking for all kinds of debugging trouble by having 2 variable   
   named so similarily   
      
      
   - Why are you doing a   
   Select Case LoginSucceded  ?   
   You are using the procedure level variable, and when the procedure is   
   entered (i.e., after the cmdOK is clicked), this variable will ALWAYS be   
   false.   
   The "Select Case LoginSucceded" makes no sense   
      
   - On the Case statements, Demo and File are not variables, if you intend for   
   these to be strings, you have to enclose these in double-quotes, use "Demo"   
   and "File".   
      
   - If you want to check the UID and PWD that a user enters, you will want to   
   open your file first, read it to see if the txtUserName.Text and   
   txtPassword.Text exist in the data file. If so, all is good, if not make the   
   user re-enter.   
      
   - I think you are trying to highlight the contents of the txtPassword   
   textbox by   
   SendKeys "{Home}+{End}"   
   - You should do the following   
   txtPassword.SetFocus   
   txtPassword.SelStart= 0   
   txtPassword.SelLength = Len(txtPassword.Text)   
      
   Try to straighten up some of that, and see how that goes   
      
   Mike   
      
      
      
   "william cline"  wrote in message   
   news:7Wh7f.19673$QE1.15285@newsread2.news.atl.earthlink.net...   
   > Hi,  I am a beginner and below I have code for a long in form.   My goal   
   > is   
   > for the form to read a file of a list of users and thier passwords   
   > ...compare the text box inputs to the file and either start over or load   
   > the   
   > main file.... I attempted to use a slect case..but its not working for   
   > me..   
   > If someone has a better way of doing it..I would apperciate the help.   
   > Thank   
   > you!   
   >   
   > Option Explicit   
   >   
   > Public LoginSucceeded As Boolean   
   >   
   >   
   > Private Sub cmdCancel_Click()   
   >    'set the global var to false   
   >    'to denote a failed login   
   >    LoginSucceeded = False   
   >    Me.Hide   
   > End Sub   
   >   
   > Private Sub cmdOK_Click()   
   >     Dim User As String   
   >     Dim Password As String   
   >     Dim inCtr As Integer   
   >     Dim LoginSucceded As Boolean   
   >     Dim Login   
   >   
   >      Login = User + Password   
   >   
   >   
   >     Select Case LoginSucceded   
   >   
   >   
   >       'demo not a variable....example..txt.Username.text is what is needed   
   >   
   >       Case Demo   
   >   
   >         User = txtUserName = "Trial"   
   >         txtPassword = "Demo"   
   >         Form_Load.frmData   
   >         Me.Hide   
   >   
   >       Case File   
   >        Open "C:\Windows\DataPwd\Pswd.pwd" For Random As #1   
   >         For i = 1 To 10   
   >         Get #1, User, Password   
   >           If Text.txtUserName = User And Text.txtPassword = Password Then   
   >           LoginSucceeded = True   
   >            Form_Load.frmData   
   >            Me.Hide   
   >         Else: Next i   
   >         End If   
   >   
   >   
   >    Else   
   >        MsgBox "Invalid Password, try again!", , "Login"   
   >        txtPassword.SetFocus   
   >        SendKeys "{Home}+{End}"   
   >    End If   
   > End Sub   
   >   
   >   
   >   
   >   
   >   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca