Code Snippet
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace testFocusAppli
{
public partial class Form1 : Form
{
public static Form2 form2;
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
form2 = new Form2();
form2.Show();
}
private void button2_Click(object sender, EventArgs e)
{
int i=0;
this.Focus();
if (this.Focused) i = 1;
}
}
}