hi......
i m making a window application in which i want to divide my form into 3 panels(left,right, and top)
in left panel i have tree view(with some nodes n childs), in top panel i have some pics
now i want that when i click on tree view node, so related form should be disply on right side panel(this thing i allready done )with the help of following code:

private void treeView1_AfterSelect_1(object sender, TreeViewEventArgs e)
        {
            switch (e.Node.Name)
            {
                case "Node1": embedForm(new Form2()); break;
                case "Node2": embedForm(new Form3()); break;
                case "Node3": embedForm(new Form4()); break;

                // etc...
            }
        }
        private void embedForm(Form frm)
        {
            // Remove existing controls
            foreach (Control ctl in panel3.Controls) ctl.Dispose();
            rightpanel.Controls.Clear();
            // Whack <frm> to turn it into a child control
            frm.FormBorderStyle = FormBorderStyle.None;
            frm.TopLevel = false;         
            frm.Visible = true;
            frm.Dock = DockStyle.Fill;
            rightpanel.Controls.Add(frm);
        }
    }

In this i phase a problem that when i click on any node in tree view, it will show the form in right panel as well as in top panel, but i want to show this only in right panel. what i want is that left and top panel will remains same, only right panel change when i click on any node.
Can anyone tell me how can i do this?
kindly provide me code, if possible..!!

Welcome to daniweb avirag! Please use code tags when posting your code

Next could you upload your project where we could see what is going on here. I cannot duplicate this behavior:

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace daniweb
{
  public partial class FormSplit : Form
  {
    private Form _frm;

    public FormSplit()
    {
      InitializeComponent();
    }

    private void button1_Click(object sender, EventArgs e)
    {
      SetForm(new frm1());
    }

    private void button2_Click(object sender, EventArgs e)
    {
      SetForm(new Form1());
    }

    private void SetForm(Form frm)
    {
      if (_frm != null)
        _frm.Dispose();

      _frm = frm;
      frm.FormBorderStyle = FormBorderStyle.None;
      frm.TopLevel = false;
      frm.Visible = true;
      frm.Dock = DockStyle.Fill;
      panelRight.Controls.Add(frm);
    }

  }
}

Hi !!!!!
how can I upload my project.....
I don't know......
kindly tell me....

Click on "Go Advanced", "Manage Attachments", then upload your zipped project.

hi!!!!!!!
I have attached my application.......
Now I want that on when on clicking the treenode the correspoding form appears., at that time top panel should also remain visible......But in my application when form appears on node click top panel disappears..........

how can I display forms in right panel by keeping top and left panel as it is ..............
Kindly tell me what changes in designing are to be done for such functionality ..........
Also provide me the C# code if required

This is your code:

private void embedForm(Form frm)
        {
            // Remove existing controls
            foreach (Control ctl in panel3.Controls) ctl.Dispose();
            panel1.Controls.Clear();

The panel1.Controls.Clear(); clears your top panel and you need to remove that line. Change it to:

private void embedForm(Form frm)
        {
            // Remove existing controls
            foreach (Control ctl in panel3.Controls) ctl.Dispose();
            //panel1.Controls.Clear();

thnks a lot........
I want u to solve One more problem......
As u have seen in my application that i have made icons in top panel, which can be for "save", "new","open","print",etc.........
I tried to link these buttons to forms in right panel in the same way as I have linked left treeview to right panel.
But they are not linking together...
Also I could not apply the functionality of top panel buttons to right panel forms........
how can I do this...
Kindly help me ..........

I would use an interface for this. You could get away with using delegates but you need to be positive that all forms implement ALL buttons so interfaces will make certain of that. Plus with interfaces you can extend to things beyond clicks :)

I have uploaded a modified version of your project. Please mark this thread as solved if you have found an answer to your questions and good luck!

Thanks 4 ur gr8 help..........:)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.