Hi friends,
I want to write a multiform application. if I am running form1, I want to call form2 and end form1. can anyone teach me how to do it? I tried to set form1 as invisible, but I found it funny that if I close form2 by clicking on the close button on the right top corner of the form. form1 is still running. So I don't think this way works practically as not all the people like the end an application by clicking the end button in the form, instead of the right top corner close button. Is my words clear enough? My English sucks
Cheers,

go to your project properties to the Application tab and change the "Shutdown Mode" to "when last Form clsoses"

if u now have Form1 open you can do
Form2.show
Form1.close

the application will still run but you dont have any forms hidden. the application will end if the current form closes.

i also recommend using mdi form

Well, just imagine that I am coding in a button of form1
I typed in
my.forms.form2.showdialog()
me.close
but the me.close will not be runned. as a result, both of the forms shows.....

Oops, I get it, just do this
me.visible = false
my.forms.form2.showdialog()
me.close
it works this way, I think :)
Thank you all!!!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.