Hi smile,
Add a toolStrip in the form and set the doc property to Left.
Then add ToolStrip button to it for displaying the form on click.
Then in the right side add a Panel control which will be used to open the form inside it.
Check this example. Now please take its reference and correct your code.
Code
C#
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void StudentForm_Click(object sender, EventArgs e)
{
pnlForms.Controls.Clear();
StudentForm form = new StudentForm();
form.TopLevel = false;
pnlForms.Controls.Add(form);
form.FormBorderStyle = FormBorderStyle.None;
form.Dock = DockStyle.Fill;
form.Show();
}
private void ExamForm_Click(object sender, EventArgs e)
{
pnlForms.Controls.Clear();
ExamForm form = new ExamForm();
form.TopLevel = false;
pnlForms.Controls.Add(form);
form.FormBorderStyle = FormBorderStyle.None;
form.Dock = DockStyle.Fill;
form.Show();
}
private void FeeForm_Click(object sender, EventArgs e)
{
pnlForms.Controls.Clear();
FeeForm form = new FeeForm();
form.TopLevel = false;
pnlForms.Controls.Add(form);
form.FormBorderStyle = FormBorderStyle.None;
form.Dock = DockStyle.Fill;
form.Show();
}
}
VB.Net
Public Class Form1
Private Sub StudentForm_Click(ByVal sender As Object, ByVal e As EventArgs)
pnlForms.Controls.Clear()
Dim form As StudentForm = New StudentForm()
form.TopLevel = False
pnlForms.Controls.Add(form)
form.FormBorderStyle = FormBorderStyle.None
form.Dock = DockStyle.Fill
form.Show()
End Sub
Private Sub ExamForm_Click(ByVal sender As Object, ByVal e As EventArgs)
pnlForms.Controls.Clear()
Dim form As ExamForm = New ExamForm()
form.TopLevel = False
pnlForms.Controls.Add(form)
form.FormBorderStyle = FormBorderStyle.None
form.Dock = DockStyle.Fill
form.Show()
End Sub
Private Sub FeeForm_Click(ByVal sender As Object, ByVal e As EventArgs)
pnlForms.Controls.Clear()
Dim form As FeeForm = New FeeForm()
form.TopLevel = False
pnlForms.Controls.Add(form)
form.FormBorderStyle = FormBorderStyle.None
form.Dock = DockStyle.Fill
form.Show()
End Sub
End Class
Screenshot