FIRST ANSWER
What have you tried?
Where are you stuck?
Have you divided the problem in parts?
A) do you know how to prepare an event handler for your edit box? you will need to generate an event handler to catch the return key on that edit box and then react to the content of it.
B) have you limited the possibility to enter only numbers into that edit box? see this
link[
^].
C) do you know how to create a list that have any add method to capture the numbers and allow it to grow? (see this
link[
^]).
D) do you know how to create a message box? See this
link[
^].
E) about the for loop... well, see this
link[
^].
All your questions can be solved by trying to understand the problem as small parts and then implement them little by little. Don't try to make everything at once.
You should definitely explain a little bit more the last part about the for loop... and showing the result in a message box...
I can't understand why you need a loop to enter the values... the GUI will handle as many returns you press and each time you press return and a good entry has been processed you should be able to increase the counter inside the same enter key handler.
Then my question is: which result do you want to show? and when has this result to be applied?
If after each enter key press you want to show a message box then you don't need any loop here.
SECOND ANSWER
To convert a string to an integer you can use this:
Dim str1 As String = Nothing
Dim int1 As Integer = Nothing
str1 = "10"
int1 = Convert.ToInt32(str1)
THIRD ANSWER
Given your code you've lied to everyone several times... :sigh:
See that you said in your question that: "Once the enter key is pressed" keypress event, now you say that you do that on the event of a button click.
You've not presented code and when you've done it the code is telling me different things than you question...
Well, I would do this:
Private Sub BtnAdd_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnAdd.Click
if (IsNumeric(TextBoxValue.Text))
then
lblTotal.Text = Convert.ToString(Convert.ToInt32(lblTotal.Text) + Convert.ToInt32(TextBoxValue.Text))
end if
End Sub
Improve the way you make questions and you get a better result. It was impossible to answer what I've put here at the end before making all the steps I've made due to your bad question. See that I've spent time searching the Internet to find links (which you could have found), and that at the end and after a lot of comments I've given you a completely different solution.
I'm saying all this because here in CP you can find lot's of people willing to help, but this has been a clear example of a bad question.
Typically this kind of questions go directly to oblivion due to low votes.
Do it better the next time.
See the code. Try to understand it. If you have doubts then come back. ;)
PS: I've not compiled it, I've never worked with VB.NET, but this is a really easy thing to achieve.
Good luck.