Dear,
How can stop if form already open.
For Example i showed my form in panel but when i click its opening again and again so how can i stop this.. when i click one time should be open if i click second time should be not open again..
below my code..
private void Store_information_button_Click(object sender, EventArgs e)
{
try
{
StoresInformation storeinformation = new StoresInformation();
storeinformation.TopLevel = false;
Showing_Data_panel1.Controls.Add(storeinformation);
storeinformation.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
storeinformation.Dock = DockStyle.Fill;
storeinformation.Show();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
{
try
{
StoresInformation storeinformation = new StoresInformation();
storeinformation.TopLevel = false;
Showing_Data_panel1.Controls.Add(storeinformation);
storeinformation.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
storeinformation.Dock = DockStyle.Fill;
storeinformation.Show();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}

Raja TRank #685 · 3.5K reputationPosted Jan 11, 2016, 5:53 PM EST
Form fc = Application.OpenForms["UpdateWindow"]; if (fc != null) fc.Close(); fm.Show();Ranjit PowarRank #553 · 4.4K reputationPosted Jan 3, 2016, 4:33 AM EST
bool isFound=false;
foreach (Form frm in Application.OpenForms)
{
if(from.Name=="YourFormName")
isFound=true;
}
if(!isFound)
{
//open form here
}
Feroz KhanRank #3,748 · 395 reputationPosted Jan 11, 2016, 2:00 AM EST
Ranjit PowarRank #553 · 4.4K reputationPosted Jan 11, 2016, 2:38 AM EST
{
if(frm.Name=="YourFormName")
isFound=true;
}
if(!isFound)
{
//open form here
John Lester Almenanza4 reputationPosted Jan 11, 2016, 4:31 PM EST