Open Windows Form in specific area while click on left side navigation bar using C# and VB.Net

smile
 
on Sep 03, 2021 10:48 PM
Sample_909720.zip
384 Views

Issue in opening window form in specific area while click on left side navigation bar

Student Form

Exam Form

Fee Form

When Click on Student form. In this area the window form

"Student Form" must be open when I click on Student Form button. 

When I click on Exam Form, then the exam form must be open.

To Sum up, when I click on any button in the navigation bar on left side, in

This area, the related new form must be open. How to get solution. I want get solution with simple form and using Telerik UI for win forms.

how to get solution please.

Download FREE API for Word, Excel and PDF in ASP.Net: Download
dharmendr
 
on Sep 04, 2021 03:40 AM

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