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. [Message Deleted]

[Message Deleted]

Scheduled Pinned Locked Moved C#
5 Posts 5 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.
  • S Offline
    S Offline
    shyamy
    wrote on last edited by
    #1

    [Message Deleted]

    E A G A 4 Replies Last reply
    0
    • S shyamy

      [Message Deleted]

      E Offline
      E Offline
      ejuanpp
      wrote on last edited by
      #2

      Hi, Comments about what ?

      1 Reply Last reply
      0
      • S shyamy

        [Message Deleted]

        A Offline
        A Offline
        AB7771
        wrote on last edited by
        #3

        What actually do u want to do? And comments about wht?

        Thanks & Regards, Pramod "Everyone is a genius at least once a year"

        1 Reply Last reply
        0
        • S shyamy

          [Message Deleted]

          G Offline
          G Offline
          Guffa
          wrote on last edited by
          #4

          Comments:

          shyamy wrote:

          int Count=txtEnter.Text.Length,i=0;

          Local variables are generally named with the first character in lower case, e.g. count instead of Count. There is no reason to initalise the variable i, as you are not using it before you initialise it again in the loop.

          for(i=Count;i>0;i--)

          Why are you looping from Count to 1 instead of from Count-1 to 0?

          txtChange.Text+=myString.Substring(i-1,1);

          Use a StringBuilder to build the string. That way you don't create so many string objects. Using the += operator to concatenate strings scales very badly; the execution time increases exponetially for each character you add. Instead of using SubString, use the indexer to get the character: myString[i-1], that way you use a char value to handle the character instead of creating another string object.

          --- b { font-weight: normal; }

          1 Reply Last reply
          0
          • S shyamy

            [Message Deleted]

            A Offline
            A Offline
            albCode
            wrote on last edited by
            #5

            private void btnChange_Click(object sender, System.EventArgs e) { //Variable which contains length (number of characters) of textbox txtEnter int Count=txtEnter.Text.Length; //Another variable which is called i and have 0 default value int i=0; //string variable which contains string of txtEnter control string myString=txtEnter.Text; //control loop which gives inverse word of myString variable //example: Hello for(i=Count;i>0;i--) { txtChange.Text+=myString.Substring(i-1,1); } } //result of txtChange TextBox control is olleH //Event which call Close() method private void btnExit_Click(object sender, System.EventArgs e) { this.Close(); } Hope this helps


            "My advice to you is to get married. If you find a good wife, you will be happy; if not, you will become a philosopher." Socrates

            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