I have one problem for calling user control from another user control my code like this :
public UserControl1()
{
InitializeComponent();
}
private void commandBarButtonInsert_Click(object sender, EventArgs e)
{
UserControl2 usr2 = new UserControl2();
this.Hide();
this.Parent.Controls.Add(usr2);
}
it is returning this error :
System.NullReferenceException: Object reference not set to an instance of an object
. How can I solve this problem ?