Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. LINQ
  4. change image every day c# Linq

change image every day c# Linq

Scheduled Pinned Locked Moved LINQ
csharplinqquestion
6 Posts 5 Posters 18 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C Offline
    C Offline
    christina p
    wrote on last edited by
    #1

    How can i change image everyday I have 1 to 1 of december and 2 december and up to 24 december C# Linq

    M K 2 Replies Last reply
    0
    • C christina p

      How can i change image everyday I have 1 to 1 of december and 2 december and up to 24 december C# Linq

      M Offline
      M Offline
      Maciej Los
      wrote on last edited by
      #2

      What have you tried?

      1 Reply Last reply
      0
      • C christina p

        How can i change image everyday I have 1 to 1 of december and 2 december and up to 24 december C# Linq

        K Offline
        K Offline
        Krellon
        wrote on last edited by
        #3

        Make sure you have enough images in the images folder :P

         List images = new List();
        
         for (int i = 0; i < DateTime.DaysInMonth(2018, 2); i++)
         {
             images.Add(Image.FromFile(@"\\IMG" + i + ".jpg"));
         }
                
         var currentImage = images\[DateTime.Now.Day\];
        
        Richard DeemingR 1 Reply Last reply
        0
        • K Krellon

          Make sure you have enough images in the images folder :P

           List images = new List();
          
           for (int i = 0; i < DateTime.DaysInMonth(2018, 2); i++)
           {
               images.Add(Image.FromFile(@"\\IMG" + i + ".jpg"));
           }
                  
           var currentImage = images\[DateTime.Now.Day\];
          
          Richard DeemingR Offline
          Richard DeemingR Offline
          Richard Deeming
          wrote on last edited by
          #4

          Why are you loading every image for the month, when you only want one?

          string fileName = string.Format(@"\IMG{0}.jpg", DateTime.Today.Day);
          var currentImage = Image.FromFile(fileName);


          "These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer

          "These people looked deep within my soul and assigned me a number based on the order in which I joined" - Homer

          K D 2 Replies Last reply
          0
          • Richard DeemingR Richard Deeming

            Why are you loading every image for the month, when you only want one?

            string fileName = string.Format(@"\IMG{0}.jpg", DateTime.Today.Day);
            var currentImage = Image.FromFile(fileName);


            "These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer

            K Offline
            K Offline
            Krellon
            wrote on last edited by
            #5

            Good point!

            1 Reply Last reply
            0
            • Richard DeemingR Richard Deeming

              Why are you loading every image for the month, when you only want one?

              string fileName = string.Format(@"\IMG{0}.jpg", DateTime.Today.Day);
              var currentImage = Image.FromFile(fileName);


              "These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer

              D Offline
              D Offline
              David McGraw
              wrote on last edited by
              #6

              Good one Richard.

              1 Reply Last reply
              0
              Reply
              • Reply as topic
              Log in to reply
              • Oldest to Newest
              • Newest to Oldest
              • Most Votes


              • Login

              • Don't have an account? Register

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • World
              • Users
              • Groups