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. C#
  4. Do something X times

Do something X times

Scheduled Pinned Locked Moved C#
8 Posts 8 Posters 0 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.
  • J Offline
    J Offline
    jammmie999
    wrote on last edited by
    #1

    Hi Is it possible to do some code X times e.g.

    //10 times
    messagebox.show("Hello");

    Thanks

    M A C 0 S 5 Replies Last reply
    0
    • J jammmie999

      Hi Is it possible to do some code X times e.g.

      //10 times
      messagebox.show("Hello");

      Thanks

      M Offline
      M Offline
      molesworth
      wrote on last edited by
      #2

      Ummm, maybe I'm being dense and not really understanding your question, but what's wrong with a for loop?

      There are three kinds of people in the world - those who can count and those who can't...

      1 Reply Last reply
      0
      • J jammmie999

        Hi Is it possible to do some code X times e.g.

        //10 times
        messagebox.show("Hello");

        Thanks

        A Offline
        A Offline
        Abhijit Jana
        wrote on last edited by
        #3

        jammmie999 wrote:

        Hi Is it possible to do some code X times e.g. //10 times messagebox.show("Hello");

        Simply Use Loop. :-O

        cheers, Abhijit CodeProject MVP Web Site:abhijitjana.net

        1 Reply Last reply
        0
        • J jammmie999

          Hi Is it possible to do some code X times e.g.

          //10 times
          messagebox.show("Hello");

          Thanks

          C Offline
          C Offline
          Christian Graus
          wrote on last edited by
          #4

          It's obvious you know nothing about programming, yet. So, buy a book before you ask the most elementary questions here. Knowing what a messagebox is, before knowing about basic constructs, will only create holes in your knowledge that you may never adequately fill. Do a course, or buy a basic book and read all of it.

          Christian Graus Driven to the arms of OSX by Vista. Please read this[^] if you don't like the answer I gave to your question. "! i don't exactly like or do programming and it only gives me a headache." - spotted in VB forums.

          1 Reply Last reply
          0
          • J jammmie999

            Hi Is it possible to do some code X times e.g.

            //10 times
            messagebox.show("Hello");

            Thanks

            0 Offline
            0 Offline
            0x3c0
            wrote on last edited by
            #5

            MessageBox.Show("Hello");
            MessageBox.Show("Hello");
            MessageBox.Show("Hello");
            MessageBox.Show("Hello");
            MessageBox.Show("Hello");
            MessageBox.Show("Hello");
            MessageBox.Show("Hello");
            MessageBox.Show("Hello");
            MessageBox.Show("Hello");
            MessageBox.Show("Hello");

            Seriously; look at a for-loop

            for(int i = 0; i < UpperBound; i++)
            {
            //Action here
            }

            If there's only one action, then you can drop the { and }

            Between the idea And the reality Between the motion And the act Falls the Shadow

            M 1 Reply Last reply
            0
            • 0 0x3c0

              MessageBox.Show("Hello");
              MessageBox.Show("Hello");
              MessageBox.Show("Hello");
              MessageBox.Show("Hello");
              MessageBox.Show("Hello");
              MessageBox.Show("Hello");
              MessageBox.Show("Hello");
              MessageBox.Show("Hello");
              MessageBox.Show("Hello");
              MessageBox.Show("Hello");

              Seriously; look at a for-loop

              for(int i = 0; i < UpperBound; i++)
              {
              //Action here
              }

              If there's only one action, then you can drop the { and }

              Between the idea And the reality Between the motion And the act Falls the Shadow

              M Offline
              M Offline
              Mycroft Holmes
              wrote on last edited by
              #6

              Uhm, dah, uhm whats UpperBound and why do you have a double ++ after i

              Never underestimate the power of human stupidity RAH

              L 1 Reply Last reply
              0
              • M Mycroft Holmes

                Uhm, dah, uhm whats UpperBound and why do you have a double ++ after i

                Never underestimate the power of human stupidity RAH

                L Offline
                L Offline
                Luc Pattyn
                wrote on last edited by
                #7

                these are just minor typos; anyway you're better of with an OK-Cancel kind of interface so the user can chose the number of greetings he gets. :)

                Luc Pattyn [Forum Guidelines] [My Articles]


                The quality and detail of your question reflects on the effectiveness of the help you are likely to get. Show formatted code inside PRE tags, and give clear symptoms when describing a problem.


                1 Reply Last reply
                0
                • J jammmie999

                  Hi Is it possible to do some code X times e.g.

                  //10 times
                  messagebox.show("Hello");

                  Thanks

                  S Offline
                  S Offline
                  saanj
                  wrote on last edited by
                  #8

                  Hi, If you have already used MessageBox.Show, then I am quite sure that you have also used the for loop. :)

                  Either you love IT or leave IT...

                  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