You don't need to get the ActiveForm - that may even by your problem. Instead, use the current instance:
private void Main_Load(object sender, EventArgs e)
{
Main1 one = new Main1();
one.MdiParent = this;
one.Show();
}
"still the exception is occurring at the same place!"
Then the problem is that you are using Hide in the Load event - this is getting execturted before the MDI parent is completely ready for it: move your code to the form Shown event instead:
private void Main1_Shown(object sender, EventArgs e)
{
t1 = DateTime.Now;
t2 = Convert.ToDateTime("16:00:00 ");
bpaper test = new bpaper();
if (t1 < t2)
{
MessageBox.Show("less than 4.00 P.M");
this.Hide();
test.Show();
}
else
{
MessageBox.Show("Time out ", t1.ToString());
Application.Exit();
}
}
But why are you doing it that way anyway - bpaper is not a MDI child, so why create the Main1 instance at all? Why not do this in the Main form instead, or even in the Main method of the program.cs file?