Error: Constant expression is required

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • ashiremath
    New Member
    • Feb 2008
    • 2

    Error: Constant expression is required

    Hi All
    Below the code giving me the error is
    Constant expression is required.
    Please help me for this program.

    Private Sub Send_InputChoic e()
    Dim Input_String As Integer

    Const n As Integer = chs
    n = chs

    Do Until n = 0
    Input_String = n
    oLaunch.Write(I nput_String & vbCrLf)
    txtOutput.Text = txtOutput.Text & Input_String
    txtOutput.Selec tionStart = Len(txtOutput.T ext)
    If poweroff = "off" Then
    n = n - 1
    'Next n
    End If
    Loop
    End Sub
  • QVeen72
    Recognized Expert Top Contributor
    • Oct 2006
    • 1445

    #2
    Hi,

    When you declare a Constant, you can not assign a Variable value, it has to be declared explicitly :

    Const n As Integer = 20

    Regards
    Veena

    Comment

    Working...