I am writing a program that when a user enters his initial age: lets say 23, and then in another text box he enters in his age on retirement: lets say 86, I want to display data as show below:
24
25
26
27
28
29
.
.
.
86
I am currently using this code but it is not working the way i wanted it to can someone please tell me what i am doing wrong? It just keeps counting and counting and never stops at 86 if that is what the user enters in the Age on Retirement textbox. Please help?
Dim iEndAge As Integer = 0
Dim iCount As Integer = txtAge.Text 'used to increment the initial age
While iEndAge <= txtOldAge.Text
iCount = iCount + 1 'increment Initial Age
rtbDisplay.Text = rtbDisplay.Text & vbNewLine & vbNewLine & iCount
End While
24
25
26
27
28
29
.
.
.
86
I am currently using this code but it is not working the way i wanted it to can someone please tell me what i am doing wrong? It just keeps counting and counting and never stops at 86 if that is what the user enters in the Age on Retirement textbox. Please help?
Dim iEndAge As Integer = 0
Dim iCount As Integer = txtAge.Text 'used to increment the initial age
While iEndAge <= txtOldAge.Text
iCount = iCount + 1 'increment Initial Age
rtbDisplay.Text = rtbDisplay.Text & vbNewLine & vbNewLine & iCount
End While