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 I can generate a 5-digit ID in C#

How I can generate a 5-digit ID in C#

Scheduled Pinned Locked Moved C#
csharpquestion
4 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.
  • L Offline
    L Offline
    Lost User
    wrote on last edited by
    #1

    any idea?? big thx! Pawel

    K 1 Reply Last reply
    0
    • L Lost User

      any idea?? big thx! Pawel

      K Offline
      K Offline
      Kannan Kalyanaraman
      wrote on last edited by
      #2

      generate a random no , convert it to string, take out the first five characters and then convert it back to no. You can look at how to generate random nos in the System.Security.Cryptography namespace. There is a class for random no generation. Hope this helps. Cheers Kannan

      L 1 Reply Last reply
      0
      • K Kannan Kalyanaraman

        generate a random no , convert it to string, take out the first five characters and then convert it back to no. You can look at how to generate random nos in the System.Security.Cryptography namespace. There is a class for random no generation. Hope this helps. Cheers Kannan

        L Offline
        L Offline
        Lost User
        wrote on last edited by
        #3

        cool!! and thx.. but can you give me a code sample how i can generate a #? becouse i can´t find any code sample in the msdn. thx

        N 1 Reply Last reply
        0
        • L Lost User

          cool!! and thx.. but can you give me a code sample how i can generate a #? becouse i can´t find any code sample in the msdn. thx

          N Offline
          N Offline
          Neil Van Note
          wrote on last edited by
          #4

          I am still pretty new to C#, but on a hunch I would check out the Random class... :rolleyes:

          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