| | |
the form that wont die...
Please support our Visual Basic 4 / 5 / 6 advertiser: Programming Forums - DaniWeb Sister Site
![]() |
•
•
Join Date: Nov 2007
Posts: 100
Reputation:
Solved Threads: 2
This is a VB6 question.
I seem to have a problem with a form that should be unloading or at the very least become not visible. For whatever reason when another form is shown (form2.Show as an example) or made visible (Form2.Visible = True, next line would say Unload Form1 for instance), that same form (Form1) will come back up, including any message boxes as well... I quit them 2ce (sometimes 3 times) and they will finally go away for good.
It seems that on the first form in the code, even after the next form called is loaded, the code is re-read again even though i have definately unloaded it (it = the first form (Form1)).
Any ideas why this may be happening? This really is odd.
I will supply more code if needed.
thanks for any help.
I seem to have a problem with a form that should be unloading or at the very least become not visible. For whatever reason when another form is shown (form2.Show as an example) or made visible (Form2.Visible = True, next line would say Unload Form1 for instance), that same form (Form1) will come back up, including any message boxes as well... I quit them 2ce (sometimes 3 times) and they will finally go away for good.
It seems that on the first form in the code, even after the next form called is loaded, the code is re-read again even though i have definately unloaded it (it = the first form (Form1)).
Any ideas why this may be happening? This really is odd.
I will supply more code if needed.
thanks for any help.
Last edited by squidd; Nov 15th, 2008 at 10:25 pm.
•
•
Join Date: Nov 2007
Posts: 100
Reputation:
Solved Threads: 2
ok BigSeckC,
Here is the code I am having an issue with at the moment.
Now as you can see a number of things can happen here. But if it calls for a password reset, then the message box comes up 2 more times after it is clicked out. If the frmenter form is called for, then after the correct password is entered, the password form does go away, but comes back over and over endlessly. The code for the frmenter click is below:
I cant figure out why this is happening. The only thing i have found that will stop frmenter from coming back is to add 'vbModal' to the form3 that is called from form2 in the code directly above. I do not like using that however, as it isnt really solving the problem.
Any help would definately be appreciated.
Here is the code I am having an issue with at the moment.
Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
If Len(pass) <> 0 And InStr(1, pass, "reset") = False Then frmVerify.Height = 2100 Label2.Visible = True Command1.Enabled = False Command1.Caption = "Loading..." Pause 1.5 Unload frmVerify frmenter.Visible = True ElseIf InStr(1, pass, "reset") Then Unload frmVerify Form2.Show MsgBox "Your Password has been reset. Please make a new one now." Else frmVerify.Height = 1910 Command1.Visible = True frmenter.Visible = False End If 1: End Sub
Now as you can see a number of things can happen here. But if it calls for a password reset, then the message box comes up 2 more times after it is clicked out. If the frmenter form is called for, then after the correct password is entered, the password form does go away, but comes back over and over endlessly. The code for the frmenter click is below:
Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
Private Sub Command1_Click() Dim pass As String On Error GoTo program Open "C:\test.tst" For Input As #1 Input #1, pass Close #1 If Text1.Text = pass Then frmenter.Visible = False Form3.Show Else enter = MsgBox("Incorrect Password", vbError, "Error") End If Exit Sub program: Open "c:\test.tst" For Output As #1 Write #1, "reset" Close #1 End Sub
I cant figure out why this is happening. The only thing i have found that will stop frmenter from coming back is to add 'vbModal' to the form3 that is called from form2 in the code directly above. I do not like using that however, as it isnt really solving the problem.
Any help would definately be appreciated.
Last edited by squidd; Nov 16th, 2008 at 5:00 pm.
Ok... time to state the obvious... it's Looping the code.
Would a 'Do...While' help in this situation? I'm asking this as a general question to anyone...
Seems like that 'could/would' work - but I'm not proficient enough to say 'do this'.
Have you tried googling a 'pw reset snippet'? I had to do that once and it did help me understand what I was doing wrong
Would a 'Do...While' help in this situation? I'm asking this as a general question to anyone...
Seems like that 'could/would' work - but I'm not proficient enough to say 'do this'.
Have you tried googling a 'pw reset snippet'? I had to do that once and it did help me understand what I was doing wrong
I am who I am...I do what I do
•
•
Join Date: Nov 2007
Posts: 100
Reputation:
Solved Threads: 2
no i havent looked for that.. I will do it now. I know its looping the code, but i dont know why, obviously... hehe. thanks for the help.. ill check it out.
also, Im not sure how a Do While statement would help as that is a type of looping in itself. If Then isnt supposed to loop at all. That is what is so odd to me about this. It goes back to this code no matter what I do. Im sure that solution is fairly simple, yet it it isnt obvious to me, yet.
Thanks again.
also, Im not sure how a Do While statement would help as that is a type of looping in itself. If Then isnt supposed to loop at all. That is what is so odd to me about this. It goes back to this code no matter what I do. Im sure that solution is fairly simple, yet it it isnt obvious to me, yet.
Thanks again.
Last edited by squidd; Nov 18th, 2008 at 9:03 am.
I know - it's truly weird - the reasoning behind the Do..While is:
"technically" if the code is "looping" without being told to, a Do...While 'should', in effect, negate the situation. (e.g., Do this - While that - Then Quit)
The only other things I can think of would be:
1. Run the program on another box - "maybe"there is 'something' on the code box that is causing the anomaly. (e.g., bad memory address, bad spot on HDD, etc.)
2. Re-write the code using a New Form and Test with each New Line - maybe even on a different box - 1 of 2 reasons...
A. The existing file could be corrupted. <-- not entirely impossible.
B. In testing each line, you would be narrowing down where 'the loop' is coming into play.
...right now, it's honestly the only things I can think of.
*crosses fingers for a corrupted file...
Not to insult your intelligence, but by box - I mean computer. Just in case someone else was wondering...
...why do I have this sneaky feeling I'm gonna run into this too?...
"technically" if the code is "looping" without being told to, a Do...While 'should', in effect, negate the situation. (e.g., Do this - While that - Then Quit)
The only other things I can think of would be:
1. Run the program on another box - "maybe"there is 'something' on the code box that is causing the anomaly. (e.g., bad memory address, bad spot on HDD, etc.)
2. Re-write the code using a New Form and Test with each New Line - maybe even on a different box - 1 of 2 reasons...
A. The existing file could be corrupted. <-- not entirely impossible.
B. In testing each line, you would be narrowing down where 'the loop' is coming into play.
...right now, it's honestly the only things I can think of.
*crosses fingers for a corrupted file...
Not to insult your intelligence, but by box - I mean computer. Just in case someone else was wondering...
...why do I have this sneaky feeling I'm gonna run into this too?...
Last edited by BigSeckC; Nov 18th, 2008 at 8:35 pm.
I am who I am...I do what I do
Just looking at the code again...
What procedure is tied to '1:'?
...maybe there is something there...
What procedure is tied to '1:'?
vb Syntax (Toggle Plain Text)
End If 1: End Sub
...maybe there is something there...
![]() |
Similar Threads
- Tutorial: Understanding ASP classes (ASP)
- Help me please. (PHP)
- Please help i have issues with my sregister form or server. (PHP)
- your basic calender (JavaScript / DHTML / AJAX)
- get html element value using php (PHP)
- limiting account names (PHP)
- php wont submit data into the database (PHP)
Other Threads in the Visual Basic 4 / 5 / 6 Forum
- Previous Thread: using of Crviewer component.......
- Next Thread: help me to fix my counter
| Thread Tools | Search this Thread |
* 6 429 2007 access activex add age append application basic beginner birth bmp calculator cd cells.find click client code college column component connection connectionproblemusingvb6usingoledb copy creat ctrl+f data database datareport date delete dissertations dissertationthesis dissertationtopic edit error excel excelmacro file filename form hardware header iamthwee image inboxinvb internetfiledownload keypress label listbox listview liveperson login looping machine microsoft movingranges number objectinsert open oracle password prime program prompt range-objects readfile reading record refresh remotesqlserverdatabase report retrieve save search sendbyte sites sort sql sql2008 sqlserver subroutine table tags textbox time urldownloadtofile vb vb6 vb6.0 vba visual visualbasic visualbasic6 web window windows






