Submit Your Article Forum Rules

Results 1 to 8 of 8

Thread: Exit Nightmare

  1. #1
    WebProWorld MVP wenwilder's Avatar
    Join Date
    Jul 2003
    Posts
    933

    Exit Nightmare

    I have reached my frustration limit. I know the answer has to be simple...it always is..but.. I just can not figure this one out.

    I have a program I'm working on. Everything in the program works perfectly except.... the Username/Password text box won't go away!! After you sign in the Username/Password text box should exit on Okay and that should be the end of it. No! Not this one..... Instead, you sign in, it exits, it lurks, it comes back... you hit 'x" on the little box and it exits, it lurks, it comes back...

    I've tried coding it two different ways - both ways I get the same result. Here is what I have...


    If Me.UsernameTextBox.Text = "Username" And Me.PasswordTextBox.Text = "Password" Then
    MsgBox("Welcome to After Hours Dispatch")
    Me.Dispose()
    AHDMain.Show()
    Else
    MsgBox("Invalid Username/Password", 1)
    End If

    Help??
    Hidden Content
    Hidden Content
    "Cat washing IS a martial art."

  2. #2
    Senior Member Uncle Dog's Avatar
    Join Date
    Apr 2008
    Posts
    325

    Re: Exit Nightmare

    Don't recognise the code but do you test for equality with = or == ?

  3. #3
    Rest in Peace 1946 - 2013 deepsand's Avatar
    Join Date
    May 2004
    Location
    State College, PA
    Posts
    16,376

    Re: Exit Nightmare

    What scripting language are you using?

    And, can we see all of the relevant code, rather than just this snippet?

  4. #4
    WebProWorld MVP wenwilder's Avatar
    Join Date
    Jul 2003
    Posts
    933

    Re: Exit Nightmare

    Here is the VB from beginning to end....


    Public Class xLogin
    Private Sub OK_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles OK.Click

    If Me.UsernameTextBox.Text = "Username" And Me.PasswordTextBox.Text = "Password" Then
    MsgBox("Welcome to After Hours Dispatch")
    Me.Dispose()
    AHDMain.Show()
    Else
    MsgBox("Invalid Username/Password", 1)
    End If
    End Sub

    Private Sub Cancel_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Cancel.Click
    Me.Close()
    End Sub

    End Class


    And that's it...
    Hidden Content
    Hidden Content
    "Cat washing IS a martial art."

  5. #5
    Rest in Peace 1946 - 2013 deepsand's Avatar
    Join Date
    May 2004
    Location
    State College, PA
    Posts
    16,376

    Re: Exit Nightmare

    Quote Originally Posted by wenwilder View Post
    If Me.UsernameTextBox.Text = "Username" And Me.PasswordTextBox.Text = "Password"
    Try encapsulating both tests in parentheses.

    If (Me.UsernameTextBox.Text = "Username") And (Me.PasswordTextBox.Text = "Password") ...

    Might also try changing And to AndAlso if you're using VB.NET.

  6. #6
    Junior Member Smeagol's Avatar
    Join Date
    Apr 2009
    Location
    Eindhoven, Netherlands
    Posts
    25

    Re: Exit Nightmare

    If this is part of another page, and the 'state' of the login is not kept, every page refresh or reload will cause the window to appear again. I'd try ussing a 'session.contents(LoginState)' as another parameter to test against. Setting this parameter as things happen, and chacking against it as things happen again. Another possible solution (not the best) is put the login screen elements in a DIV and set the style to 'display:hidden' on a button action.

  7. #7
    Rest in Peace 1946 - 2013 deepsand's Avatar
    Join Date
    May 2004
    Location
    State College, PA
    Posts
    16,376

    Re: Exit Nightmare

    Afterthought upon awakening this morning re. "Username" and "Password" - Are you temporarily testing for these specific character strings; or, are these to be variable names?

    If the latter, you'll need to get rid of the parentheses.

  8. #8
    WebProWorld MVP wenwilder's Avatar
    Join Date
    Jul 2003
    Posts
    933

    Re: Exit Nightmare

    Quote Originally Posted by deepsand View Post
    Afterthought upon awakening this morning re. "Username" and "Password" - Are you temporarily testing for these specific character strings; or, are these to be variable names?

    If the latter, you'll need to get rid of the parentheses.

    Testing specific at this point. They'll be variable eventually. I have to get the stupid window perminantly to close after exit. I'll try the parantheses, didn't think of that....
    Hidden Content
    Hidden Content
    "Cat washing IS a martial art."

Similar Threads

  1. Exit Target Of a Web Page
    By pinakijava in forum Web Programming Discussion Forum
    Replies: 2
    Last Post: 08-12-2005, 06:16 AM
  2. Exit survey recommendations?
    By edthomas in forum eCommerce Discussion Forum
    Replies: 3
    Last Post: 06-15-2004, 08:28 PM
  3. IPO as a mean of exit strategy
    By ReviewGolf.com in forum Google Discussion Forum
    Replies: 3
    Last Post: 05-19-2004, 09:32 PM
  4. Exit Code Help
    By JCM in forum Web Programming Discussion Forum
    Replies: 5
    Last Post: 05-06-2004, 10:56 AM
  5. pop-up on exit problem
    By cacooke in forum Web Programming Discussion Forum
    Replies: 8
    Last Post: 12-03-2003, 06:13 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •