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. Visual Basic
  4. convert anynumber to text [modified]

convert anynumber to text [modified]

Scheduled Pinned Locked Moved Visual Basic
questionlounge
4 Posts 4 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.
  • P Offline
    P Offline
    playout
    wrote on last edited by
    #1

    Hi, I need to do something similiar to: I need to convert any random number, to text. How would I do this? private function getDateFormat() as string Dim theDate as string = "01-06-2005 13:45:30" Dim theDateFormat as string = "dd-mm-yyyy hh:mm:ss" 'need function here to convert to text, or something else? return "1st June 2005, Quarter-To-Two" End sub

    H G T 3 Replies Last reply
    0
    • P playout

      Hi, I need to do something similiar to: I need to convert any random number, to text. How would I do this? private function getDateFormat() as string Dim theDate as string = "01-06-2005 13:45:30" Dim theDateFormat as string = "dd-mm-yyyy hh:mm:ss" 'need function here to convert to text, or something else? return "1st June 2005, Quarter-To-Two" End sub

      H Offline
      H Offline
      Hessam Jalali
      wrote on last edited by
      #2

      what do you mean any number?!! if you mean double single integer ,... you can use ToString method for making your method work for all types simply use Object like Private Function ConvertToString(byval obj as Object)as string return obj.ToString() End Function and there is another way too use Convert.ToString method but I have some doubt you wanted that when I look at your code!

      1 Reply Last reply
      0
      • P playout

        Hi, I need to do something similiar to: I need to convert any random number, to text. How would I do this? private function getDateFormat() as string Dim theDate as string = "01-06-2005 13:45:30" Dim theDateFormat as string = "dd-mm-yyyy hh:mm:ss" 'need function here to convert to text, or something else? return "1st June 2005, Quarter-To-Two" End sub

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

        A date is not a number. You can use the DateTime.ParseExact method to parse your string into a DateTime value. When you have the DateTime value, you can format it any way you like. There is no built-in format like "Quarter-To-Two", so you have to implement that yourself.

        --- single minded; short sighted; long gone;

        1 Reply Last reply
        0
        • P playout

          Hi, I need to do something similiar to: I need to convert any random number, to text. How would I do this? private function getDateFormat() as string Dim theDate as string = "01-06-2005 13:45:30" Dim theDateFormat as string = "dd-mm-yyyy hh:mm:ss" 'need function here to convert to text, or something else? return "1st June 2005, Quarter-To-Two" End sub

          T Offline
          T Offline
          The ANZAC
          wrote on last edited by
          #4

          What you are askng is complex. There is no in built function in .net to return a given number as words. You would have to build a module and pass values to it, but this module would be very big and you would have to enter each word corresponding to a number manuelly.

          Please check out my articles: The ANZAC's articles

          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