In this post we will see how to create a Sliding Panel using VB.NET. How to use Sliding Panel in VB.NET.
What is Panel in Visual Basic?
Panel control is like a container for the other controls on the page. It controls the appearance and visibility of controls which it contains. It allows generating controls also. It doesn’t have any method or event of its own. We can use many properties of the panel which makes it look effective like scroll bars, background image etc. For making the panel to be slide we can make it work as sliding panel.
Sliding Panel is one great view or design to be used in our system. Sliding Panel is one way of showing some animations in our system with this we can have some effects on our system.
How can we Create an Application having a Sliding Panel in VB.NET
For this we will make an application in which we use a interactive way of presentation using panel which is present in our visual studio toolbox.
Open your Visual studio > Go to File menu > Click on New Project > Select Visual Basic windows Application > Name the project > Click on OK.
On Form1 drag and drop one Panel, one Lable and one Button from the toolbox.Adjust the panel on top of the form. Give the background color to panel whatever you want. Set text on the label as “Click on the Below Button”. And set the text of the button as Slide Down.
After designing this form now slide down the panel and then right click on it and select Bring to Front option. Now drag and drop one label and one Button on the panel from toolbox. Set the text on this label as Hello friends, and the Button as Slide Up.
Now double click on the First Button which we have given the name as Slide Down and write to the below code.
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Label2.Hide() While (Panel1.Height < 420) Panel1.Height += 1 End While Label2.Show() End Sub
Now Again Slide Down the panel and double click on the second Button which we have given the name as Slide Up and write the below code there.
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click Label1.Hide() While (Panel1.Height > 75) Panel1.Height -= 1 End While Label1.Show() End Sub End Class
Finally run the application.
First the window will show like below.
When we click on the Slide Down Button then the panel will slide towards down.
Now click on the Slide Up Button.
When we click on the Slide Up Button then the panel will go up and then the form will show like it was showing in starting.
So in this way we can easily create a Sliding Panel in VB.NET.