Closed Thread
Results 1 to 6 of 6

Thread: C# int related question

  1. #1
    Join Date
    Feb 2010
    Posts
    3
    Rep Power
    0

    C# int related question

    Hey i'm new to this forum aswell as programming..

    So i'm currently doing some C#, and i want to make some changes on int's <10

    Is there a way i can convert int X to int 0X

    Like 5 -> 05

    Basicly just a zero in front of the int.

  2. CODECALL Circuit advertisement
    Join Date
    Always
    Posts
    Many

     
  3. #2
    Join Date
    Jul 2008
    Location
    Somewhere that is shorter to write than "In the gloomy shadows of my personal namespace"
    Posts
    10,725
    Blog Entries
    2
    Rep Power
    90

    Re: C# int related question

    Depends on the context. It is a formatting problem. An integer variable will store the same value nevertheless (an integer variable set to 5 would store the same value as one set to 05), but the way you present it can be altered. You would have to give us more details before we can help you.
    Hey! Check out my new Toyota keyboaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa

  4. #3
    Join Date
    Feb 2010
    Posts
    3
    Rep Power
    0

    Re: C# int related question

    Well the value will of course be 5, but i want it displayed as 05 in a textbox

  5. #4
    QuackWare is offline Learning Programmer
    Join Date
    Jan 2010
    Posts
    95
    Rep Power
    8

    Re: C# int related question

    You can just display it as a string with 0 tacked on or something.

    Like this:

    Code:
    textBox1.Text = "0" + x;

  6. #5
    Join Date
    Feb 2010
    Posts
    3
    Rep Power
    0

    Re: C# int related question

    Well ofc! Thx mate

  7. #6
    lobo521 is offline Learning Programmer
    Join Date
    Jan 2010
    Posts
    57
    Rep Power
    8

    Re: C# int related question


Closed Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 0
    Last Post: 01-20-2011, 12:44 AM
  2. Replies: 0
    Last Post: 08-17-2010, 01:52 PM
  3. Had a laptop related question?
    By alphamedical in forum Computer Hardware
    Replies: 1
    Last Post: 08-24-2009, 04:58 AM
  4. JSP related question
    By thieflock in forum Java Help
    Replies: 2
    Last Post: 05-05-2009, 12:38 PM
  5. RichTextBox related question
    By cygnusX in forum C# Programming
    Replies: 1
    Last Post: 10-15-2007, 01:40 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts