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. how to do Right Alignment?

how to do Right Alignment?

Scheduled Pinned Locked Moved C#
helptutorialquestion
3 Posts 3 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.
  • M Offline
    M Offline
    muhammad_umair
    wrote on last edited by
    #1

    Hi, i am making an application in which the label keeps scrolling up. The problem i have is i want to do right alignment so that i get "." in a sequence like Basket........... ball................ keyboard....... can anyone help me with this please!! i have tried this, but it isn't working for me, for (int u = textBox1.Length; u = 40 ; u++) { strDotsBuilder.Append("."); }

    C L 2 Replies Last reply
    0
    • M muhammad_umair

      Hi, i am making an application in which the label keeps scrolling up. The problem i have is i want to do right alignment so that i get "." in a sequence like Basket........... ball................ keyboard....... can anyone help me with this please!! i have tried this, but it isn't working for me, for (int u = textBox1.Length; u = 40 ; u++) { strDotsBuilder.Append("."); }

      C Offline
      C Offline
      Calla
      wrote on last edited by
      #2

      You should check your for loop again. int u = textBox1.Length; u = 40 should probably be int u = textBox1.Length; u < 40 [EDIT] Actually, your code shouldn't even compile. Did you do a typo here on CP? [/EDIT]

      modified on Tuesday, October 20, 2009 2:57 AM

      1 Reply Last reply
      0
      • M muhammad_umair

        Hi, i am making an application in which the label keeps scrolling up. The problem i have is i want to do right alignment so that i get "." in a sequence like Basket........... ball................ keyboard....... can anyone help me with this please!! i have tried this, but it isn't working for me, for (int u = textBox1.Length; u = 40 ; u++) { strDotsBuilder.Append("."); }

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

        The only way I know to do that successfully is by selecting a monospaced font such as "Courier New", then append filler characters (for which string.PadRight is useful). :)

        Luc Pattyn


        I only read code that is properly indented, and rendered in a non-proportional font; hint: use PRE tags in forum messages


        Local announcement (Antwerp region): Lange Wapper? 59.24% waren verstandig genoeg om NEEN te stemmen; bye bye viaduct.


        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