Problem With Form

jothis

Active Member
Licensed User
Hi Friends
I Created two Form. Form1,Form2 And A button Named Login In the Form1 When I Click Login It Will Navigate To Form2 When I Close The Second Form Using The Close Button The Previous Form1 Is Still There

I writed This Code On The Login Button Click Event

Sub Button1_Click
Form2.Show
Form1.Close
End Sub

But The Whole Application Is Exit. Is There Any Way To Close The First Form?
Please Help me
Please See The Example
jothis
:sign0085::sign0085:
 

Attachments

  • 1.sbp
    839 bytes · Views: 219
Last edited:

jothis

Active Member
Licensed User
Dear taximania,

I will explain again,

In my program I have two forms.
So when I run the program, The first form, form1 will open.
And when I click on that button (If I don't close the first form), I will go to form2.

So when I click on the close(X), in the form2. I am going to form1.
So , But I don't want to return to previous form.
If I close a form, I want to close complete application instead of going to previous forms.

If I have more than 100 forms, I will return to each form when I close each form.

So I wish to close my application.

I think you understand what i meant.

can you help me please.

with Thanks,
Jothis
 

jothis

Active Member
Licensed User
Hi taximania,

Thanks for your help, I was looking for that code long time.
Thank you very much for helping.

BUT NOW I NEED AGAIN HELP

Now I created a new program,
Where I created forms by coding. with AddForm functions

see the code

Sub Globals
'Declare the global variables here.

End Sub

Sub App_Start
Design
End Sub
Sub Design
AddForm("FIRSTFORM","First")
FIRSTFORM.Show
End Sub
Sub FIRSTFORM_Close
AppClose
End Sub



So when I close that form, I got an error.
Please see the attachment. Can you help me please.



Jothis
 

Attachments

  • 2.sbp
    416 bytes · Views: 199
  • 2-1.sbp
    645 bytes · Views: 169
Last edited:

taximania

Well-Known Member
Licensed User
Longtime User
If you add the forms using AddControl,
then use a For Loop to add a close event for each form,
This should cut down the amount of lines of code.
Instead of a formx_Close for each Form. I think :)

I'm away for two weeks on holiday tomorrow,
Hope someone can step in to help further :sign0013:

You beat my post ;-)
 
Top