- 分享
- 0
- 人气
- 0
- 主题
- 55
- 帖子
- 345
- UID
- 295657
- 积分
- 3460
- 阅读权限
- 21
- 注册时间
- 2010-1-24
- 最后登录
- 2016-11-17
- 在线时间
- 386 小时
 
|
本帖最后由 oreeee 于 2011-12-20 04:49 PM 编辑
自学到这里却卡住了:
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 |
|