Showing posts with label Setting the focus on Open form.. Show all posts
Showing posts with label Setting the focus on Open form.. Show all posts

Monday, November 10, 2008

Setting the focus on Open form.

using System;
using System.Collections.Generic;
using System.Text;
using System.Text.Regularex-pressions;
using System.Windows.Forms;
namespace Utility
{
class Validations
{
//Open Form
public static void OpenForm(Form objForm,MDIMainForm _MAIN)
{
bool isOpened = false;
for (int I = 0; I < Application.OpenForms.Count; I++)
{
if (objForm.GetType().Equals(Application.OpenForms[I].GetType()))
{
isOpened = true;
Application.OpenForms[I].Focus();
objForm = null;
break;
}
}
if (!(isOpened))
{
objForm.MdiParent = _MAIN;
objForm.Show();
}
}
}
}