the form that wont die...

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)).

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.

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.

the form intermittently does the aforementioned initial problem now. VERY strange indeed.

I will attempt to redo the entire code for the form that is looping for no apparent reason in the next day or two.

Now to answer a few questions....

the "1" was used before when I was actually looking to see if a file that held the encrypted password was there or not. If it wasnt there, then "goto 1," which ended the procedure. But now I'm not using a file to store the encrypted password. I am writing it to the registry instead (also encrypted). Much better this way imho.

the Pause in the code was (and still is used) if a password has been previously entered in to load the next form. The reason i used the Pause was because the GUI looks kinda cool and it allowed for a little time for the user to see what is actually happening. The Pause is now set at 2 instead of 1.5.

Also, the Pause is a valid command since I have code to actually count (in seconds instead of milliseconds) in a separate procedure/subroutine.

Lastly, I have tried an 'unload form' already to no avail because as it loops, it simply reopens the form that was unloaded. I tried that before i posted this problem here. Good suggestion however. :)

Hope that clears some things up. The problem is still not solved though. :\

Thanks for the help very much. Im sure eventually it will get it figured out. Hopefully sooner than later. :)

Just to let you know... I tried to completely redo the code and that dide work either. Since there is 3 different if then statements, and it DOES repeat 3 times, I started thinking that the number of IF-Then statements is the reason for the number of repeats. They are all inside one subroutine/procedure.

The problem is, I cant really simplify it. I suppose i could use a "Case" statement instead, but I haven't ever seen a case argument that has multiple lines after it in any examples of source that i have looked at. Logically, it "could" work. But, I just dont know about "Case" coding that well to say for sure right now.

I will go on the premise that because in this one sub/procedure that there are 3 if..then statements. It is the only thing that makes sense at the moment for the number of repeats I am getting. Where in the heck are the experienced coders for VB? I am pretty sure that a several of them, at the very least, have enough knowledge to easily fix this little problem. :(

Patiently awaiting a reason why this thing repeats when it swhouldnt. :(

I'm assuming that the program is being told to wait 1.5 seconds before continuing. Is 'pause' not a valid command?

It makes sense 'logically'...but if it's not a command - it's not a command. :P

not a command as far as i know, there use to be a sleep command in qbasic (i think)... but writing a pause sub is doable to say the least... assuming one was written for use with this program, how its set up could be part of the problem i guess...

funny, i've never used form.visible = true / false to show or hide forms... always just used .show or .hide... didn't even know it worked until now... well there's my new thing for the day ;)

[edit]ok... so i probably shouldn't be posting at 6:30 am with no sleep... sorry, didn't notice the second page :$ [/edit]

I'm not sure I understand what you mean. But as far as the password goes, if there is no password at all, it asks if you want to make one. If not, then the password form does not come up. If you do want to. then it does.

After that, it saves the password to the registry (encoded). There is no preset pass to check. It won't look for a password until one has been created, but if it has been saved already in a prior running of the program, then the program checks for the password.

If it is there, the program will start. If not, then it wont. Simple as that.

was just wondering about the check for reset... instr will check within String1 for an instance of String2, string2 being reset, if String1 is set to anything including reset, it'll come back as true...

so reset will come back as saying, yes... it says reset...
preset will come back as saying that it says reset...
and 324resetas351 will come back as saying that it says reset...

That particular portion of code has nothing to do with a password in the way you are describing at all. That piece of code has to do with a database check for something else entirely. And it doesnt "reset" to the best of my knowledge as it is pulling an HDD volume ID.

However, that information will certainly prove to be quite valuable in the future. Thank you very much for it. :)

There are many things happening in this particular "sub." I am beginning to think that it is repeating itself due to the placement of certain lines of code OR how many times i run the code consecutively without restarting VB6. Because it is an intermittent problem sometimes as well. It either doesn't happen at all, or repeats once after the initial run, or twice after the initial run. It is REALLY frustrating. Crazyness for sure.

Even the compiled code will do the same "redo" even when it didn't in the testing phase of the code. So whatever is causing it is not fixed for sure. But, I just recently made another chg to the code (tonight) and I haven't seen it happen at all lately. That means exactly nothing though because i have had that happen before since posting this problem only to see the "redo" return. :(

awwwwwwwwww NUTS... was hoping something may have fixed this... I'm with you right now - possibly the different IF statements in your procedures. Took a small break from coding this weekend to let some things sink in for me before I move on - but I'm definitely watching this thread and *crosses fingers for a fix...

not a command as far as i know, there use to be a sleep command in qbasic (i think)... but writing a pause sub is doable to say the least... assuming one was written for use with this program, how its set up could be part of the problem i guess...

funny, i've never used form.visible = true / false to show or hide forms... always just used .show or .hide... didn't even know it worked until now... well there's my new thing for the day ;)

[edit]ok... so i probably shouldn't be posting at 6:30 am with no sleep... sorry, didn't notice the second page :$ [/edit]

LOL - hear ya... the way the code was written it appeared as though 'Pause' was being called as a Procedure - i haven't run into anything denoting that command :)

so i was just kinda assuming and hoping that i'm learning something XD

The pause is being called. I put the code for it on the previous page. Ill post it again here for you:

Sub pause(interval)
Current = Timer
Do While Timer - Current < Val(interval)
DoEvents
Loop
End Sub

now in an interesting twist, I move some stuff around in the part of the code i showed at the beginning that was looping for no apparent reason. I am not getting that same thing to happen now. It may happen later, but it hasnt started all day. So very strange indeed. Once im SURE it has fixed that problem, I will post the order I have put the code in that eliminated the code from looping. Until then, im crossing my fingers that it indeed has been corrected.

When I rearranged the code in this manner, for whatever reason, it stopped looping and the form has stayed hidden for 2 days now. I HOPE this is a done deal. I dont know why this fixed it, but i didnt do anything else but this and now it works, so (shoulder shrug). Beats me.... I am going to add reputation to both of your names BigSeckC and Kane for your help in this matter. I wont called this "solved" per se, because i still dont know for absolute sure that it is.