Error:Constant expression is required

ashiremath

Member
Joined
Feb 7, 2008
Messages
8
Programming Experience
Beginner
Hi All
Below mentione the code the error is
Constant expression is required
Please help me for this program.

Private Sub Send_InputChoice()
Dim Input_String As Integer

Const n As Integer = chs
n = chs

Do Until n = 0
Input_String = n
oLaunch.Write(Input_String & vbCrLf)
txtOutput.Text = txtOutput.Text & Input_String
txtOutput.SelectionStart = Len(txtOutput.Text)

If poweroff = "off" Then
n = n - 1
'Next n
End If

Loop

End Sub
 
If you declare "n" as a constant you can't change its value later.
 
If youre going to make it constant, set it to some value!

Const n as Integer = 123

That's the whole idea of a constant. 123 is constant, not variable. That's why it says "Constant expression is required"
 
Back
Top