How to Create a Slideshow Program

Written by jaime avelar
  • Share
  • Tweet
  • Share
  • Pin
  • Email
How to Create a Slideshow Program
Use VB.NET to create an image slideshow. (frame for photo image by Sergey Galushko from

Knowing how to create a slide-show program using Microsoft Visual Basic.NET (VB.NET) can save you time when you need to show your pictures to friends and family. VB.NET is an object-oriented computer programming language used to design Windows applications. A slide show is used to display images while pausing a few seconds in between. In a few steps you will create a slide-show VB.NET project using a picture box, list box and a few buttons.

Skill level:

Other People Are Reading

Things you need

  • Microsoft Visual Basic Express

Show MoreHide


  1. 1

    Start Microsoft Visual Basic Express, click "New Project..." on the left pane of your screen, then select "Windows Forms Application." Click "OK."

  2. 2

    Double click "Button" on the "Toolbox" pane to add a new button control. Add a second button. Double click "PictureBox" to add a new picture-box control.

  3. 3

    Double click "ListBox" to add a list-box control. Double click "OpenFileDialog" to add the control to your project. Double click "Button1" to open the "Form1.vb"module.

  4. 4

    Copy and paste the following code under "Button1_Click" to open the file dialogue Window and browse for images:

    OpenFileDialog1.Multiselect = False

        OpenFileDialog1.Filter = "Jpeg|*.jpg|Gif|*.gif|Jpeg|*.jpeg|Bitmap|*.bmp"
        OpenFileDialog1.RestoreDirectory = True
        OpenFileDialog1.Title = "Browse"
        If OpenFileDialog1.ShowDialog <> DialogResult.Cancel Then
        End If
  5. 5

    Copy and paste the following code to create a new procedure to loop through the images and pause between them using a Thread:

    Sub slideShow()

        Dim iCntr As Integer
        For iCntr = 0 To ListBox1.Items.Count - 1
            pctrBx.Image = Image.FromFile(ListBox1.Items.Item(iCntr))
        Exit Sub
    End Sub
  6. 6

    Copy and paste the following code under "Public Class Form1" to declare two global variables:

    Dim pctrBx As New PictureBox

    Dim frmFrame As New Form

  7. 7

    Click "Form1.vb" and double click "Button2." Copy and paste the following code to show the Form where the images are going to be displayed and also start the Thread:

    If ListBox1.Items.Count <> 0 Then

            frmFrame.Size = New Size(1000, 1000)
            frmFrame.BackColor = Color.Black
            frmFrame.Text = "Image Slideshow"
            pctrBx.Dock = DockStyle.Fill
            pctrBx.BackColor = Color.Black
            pctrBx.SizeMode = PictureBoxSizeMode.StretchImage
            pctrBx.BorderStyle = BorderStyle.Fixed3D
            Dim pause Thread As New Thread(AddressOf slideShow)
            MsgBox("Please select an image")
        End If
  8. 8

    Click "Form1.vb" and double click "ListBox1." Copy and paste the following code to add the selected item in the Listbox to the PictureBox control:

    PictureBox1.SizeMode = PictureBoxSizeMode.StretchImage

    PictureBox1.Image = Image.FromFile(ListBox1.SelectedItem)

  9. 9

    Click the "Debug" menu then select "Start Debugging" to run your program. Click "Button1" to browse for images. Click "Button2" to start the slide show.

Don't Miss

  • All types
  • Articles
  • Slideshows
  • Videos
  • Most relevant
  • Most popular
  • Most recent

No articles available

No slideshows available

No videos available

By using the site, you consent to the use of cookies. For more information, please see our Cookie policy.