Monday, January 31, 2011

How to convert a number variable into a string

This code describes how to convert a number variable to a string:
    • Convert number to string
      • CStr
      • IntVar.ToString
       Dim eggs As Decimal = 62
        
        Dim Charles As Integer = eggs.ToString 
        
        MessageBox.Show(Charles)  
      

1 comment:

  1. Your notes at the top are a good intro. However the code doesn't work when I paste it into Visual Studio. I'm looking for code as follows:

    Dim eggs as Decimal = 12
    Dim Charles as String = eggs.ToString
    MessageBox.Show(Charles)

    or

    Dim eggs as Decimal = 12
    Dim Charles as String = CStr(eggs)
    MessageBox.Show(Charles)


    Also.. you need to have your code in the code formatter box so that its more readable.

    ReplyDelete