On 2007-11-14 22:18:13 -0800, "ra***************@gmail.com"
<ra***************@gmail.comsaid:
how to open one form from the other form and close the first form if
there are only two forms in windows application(VB.net)
i had tried this method
dim f as new form2
form2.show( )
me.close( )
But, when i run this application both the forms are closing at the
same time
This is a C# newsgroup. If you have questions that don't involve
writing C# code, you should post them elsewhere.
That said, the basic structure of what you posted should work fine, not
counting what appears to be a typographical error in your post.
Calling "f.Show()" should show the second form, and that form should
not close just because you close the current form.
In C# it would look something like this:
class Form1 : Form
{
void SomeMethod()
{
Form2 form = new Form2();
form.Show();
Close();
}
}
And that should work fine.
If you can post C# code that concisely but completely demonstrates the
problem you're having, please feel free to follow up here with that
sample. If you require VB code, then you should post to a VB or
general-purpose .NET programming newsgroup. There still you will want
to post a concise-but-complete sample of code that demonstrates the
problem. The basic idea works fine as you describe so if you're having
trouble getting it to work, you're doing something else that's not
immediately apparent.
Pete