Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7865371
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T00:04:04+00:00 2026-06-03T00:04:04+00:00

I am currently trying to create a program that will show a slideshow of

  • 0

I am currently trying to create a program that will show a slideshow of pictures from an ImageList with variable show times from a ListView, which is acessed through a numericUpDown, but when I click the button to start, nothing happens, until the time of the slideshow ends, where the last slide is shown, then disappears straight away (if i leave out “pictureBox1.Visible = false” at the end, it stays).

current code:

private void buttonSlideshow_Click(object sender, EventArgs e)
{
    pictureBox1.Visible = true;

    for (int s = 0; s < listView1.Items.Count; s++)
    {
        listView1.Items[s].Selected = true;
        pictureBox1.Image = imageList1.Images[s];

        DateTime later = DateTime.Now.AddMilliseconds((double)numericUpDown1);
        while (DateTime.Now < later)
        {
        }

    }
        pictureBox1.Visible = false;
}

I have tried many versions of this (including using timers and switching code around) have no idea what is going wrong

numericUpDown1 is the duration of the slide, have been using integers for testing, still doesn’t work

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T00:04:05+00:00Added an answer on June 3, 2026 at 12:04 am

    Doing this:

    while (DateTime.Now < later)
    

    Is blocking your UI thread. It can’t redraw the screen while you are keeping it busy spinning it’s wheels. Use a timer with a call back instead.

    You’ll need to rework your code slightly. Rather than use a for loop, define a variable for your current slide, initialize it to zero in your click handler, make your picture box visible, load the first picture and then start your timer.

    In your timer handler, you’ll increment the current index, check it against the length of you list of slides and, if you still have slides to display, load the next one and then start the timer again (or you can use a timer that fires repeatedly, although you might want to be careful that it doesn’t fire again before you’re done handling that last one). If there are no more slides left, just do you clean up and make your picture box invisible again.

    One final note, be careful with which thread the timer is going to fire on. In win forms you can use System.Windows.Forms.Timer which fires on the UI thread and you won’t have any problems. In WPF you can use DispatcherTimer which also fires on the UI thread. Other timers generally run in their own thread and you’ll have to handle pushing anything that’s supposed to update the UI back to the UI thread.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm currently trying to create a program that estimates location based on signal strength.
I am currently trying to create a function which will allow me to pass
I am currently trying to create an Android application that loops Audio from the
I am trying to create a simple program that will allow the user to
I am trying to create a script that will run a program on each
Hey, I'm trying to write a program that will accept new tasks from people,
I an trying to create a program that will detect a face in a
I'm trying to create a desktop program that will interact with the online todo
I'm currently trying to create a kernel module that will produce data based on
I am trying to create a soundboard program which will play sounds using the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.