自学到这里却卡住了:
Exercise
Put two textboxes on your form. The first box asks users to enter a start position for a For Loop; the second textbox asks user to enter an end position for the For loop. When a button is clicked, the programme will add up the numbers between the start position and the end position. Display the answer in a message box. You can use this For Loop code
For i = startNumber To endNumber
answer = answer + i
Next i
Get the startNumber and endNumber from the textboxes.
我是这样编写的:
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim i As Integer
Dim startnumber As Integer
Dim endnumber As Integer
startnumber = startnumber.text
endnumber = endnumber.text
For i = startnumber To endnumber
Next i
MsgBox(i)
End Sub
End Class
问题就出在textbox那里。
=.=
Help!
*Exercise提取于 http://www.homeandlearn.co.uk/NET/nets3p2.html