Private Const TOKEN_LENGTH As Integer = 8 ' this may come from app.config at startup
    Private Const TOKEN_MIN As Integer = 10 ^ (TOKEN_LENGTH - 1)
    Private Const TOKEN_MAX As Integer = 10 ^ TOKEN_LENGTH - 1
    'how do I make TOKEN_FORMAT a CONST?
    Private Const TOKEN_FORMAT As String = "0".PadRight(TOKEN_LENGTH)
    'sample usage
    Dim TokenCode As String = New Random().Next(TOKEN_MIN, TOKEN_MAX).ToString(TOKEN_FORMAT)
The following code gives this error: Constant expression is required.
Private Const TOKEN_FORMAT As String = "0".PadRight(TOKEN_LENGTH)
Once defined, TOKEN_FORMAT will never change, its definition simply depends on another constant TOKEN_LENGTH. so why cant it also be compile-time evaluated?
 
     
     
     
    