Creating a Sliding Panel in VB.NET

This tutorial will teach you how to create a sliding panel in vb.net. Now, let's start this tutorial! 1. Let's start with creating a Windows Form Application for this tutorial by following the following steps in Microsoft Visual Studio: Go to File, click New Project, and choose Windows Application. 2. Next, add four LinkLabel name LinkLabel1 and LinkLabel2 that holds the Panel1 and Panel2, respectively, and linkPanel1 and linkPanel2 to show the Panels. Then Panel1 and Panel2 that will hold any objects from the toolbar. You must design your interface like this: output 3. Now, we will code our program. We will declare the variables as boolean if it was clicked.
  1. Dim bln1, bln2 As Boolean
We will create a sub procedure named lbl1() and lbl2() for showing of panels with the condition variables declared as Boolean. lbl1 procedure shows the sliding effect of Panel1.
  1. Private Sub lbl1()
  2. Timer1.Enabled = True
  3. If bln1 = False Then
  4. bln2 = False
  5. bln1 = True
  6. Else
  7. bln1 = False
  8. End If
  9. End Sub
lbl2 procedure shows the sliding effect of Panel2.
  1. Private Sub lbl2()
  2. Timer2.Enabled = True
  3. If bln2 = False Then
  4. bln1 = False
  5. bln2 = True
  6. Else
  7. bln2 = False
  8. End If
  9. End Sub
Have this code below for Timer1, to have a sliding panel for Panel1. The twist here is to increment and decrement the height of the Panel1 and used the bln1 to trigger to slide.
  1. Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
  2. If Panel2.Height = 0 Then
  3. If bln1 = True Then
  4. If Panel1.Height < 166 Then
  5. Panel1.Height = Panel1.Height + 5
  6. End If
  7. Else
  8. If Panel1.Height > 0 Then
  9. Panel1.Height = Panel1.Height - 10
  10. End If
  11. End If
  12. End If
  13. End Sub
Same goes for Timer2 for the Panel2 and bln2 to trigger to slide.
  1. Private Sub Timer2_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer2.Tick
  2. If Panel1.Height = 0 Then
  3. If bln2 = True Then
  4. If Panel2.Height < 290 Then
  5. Panel2.Height = Panel2.Height + 5
  6. End If
  7. Else
  8. If Panel2.Height > 0 Then
  9. Panel2.Height = Panel2.Height - 10
  10. End If
  11. End If
  12. End If
  13. End Sub

Output:

output For more inquiries and need programmer for your thesis systems in any kind of programming languages, just contact my number below. Best Regards, Engr. Lyndon Bermoy IT Instructor/System Developer/Android Developer/Freelance Programmer Mobile: 09488225971 Landline: 826-9296 E-mail:[email protected] Add and Follow me on Facebook: https://www.facebook.com/donzzsky Visit and like my page on Facebook at: https://www.facebook.com/BermzISware

Add new comment