作者humanfly (laguna)
看板Visual_Basic
标题Re: [VB6 ] 请VB 高手帮帮小弟 请进里面看
时间Mon Oct 13 23:57:39 2008
我是用VB2005
VB6不知同不同
Dim a, b, c, d As Integer
Dim f As Integer
a = TextBox1.Text
b = TextBox2.Text
c = TextBox3.Text
Label1.Text = ""
For f = a To b Step c
d += f
If f = a Then
Label1.Text &= f
Else
Label1.Text &= "+" & f
End If
Next
Label1.Text &= "=" & d
慢慢研究 : )
※ 引述《plsy3310 (信任=谎言)》之铭言:
: 以下 是我的 程式码 是一个回圈
: Dim a, b, c, d As Integer
: Dim f As Integer
: a = TextBox1.Text
: b = TextBox2.Text
: c = TextBox3.Text
: For f = a To b Step c
: d += f
: Next
: Label1.Text = d
: 问题来了
: 假如 a =1 b=5 c=1
: 运算出来 d 会等於15
: label1 会显示 15
: 但是 我想要 label1 显示出 1+2+3...+5=15
: 那麽我 在该 label1後 面 写什麽 请 高手 帮帮忙 谢谢
※ 编辑: humanfly 来自: 218.172.48.165 (10/13 23:58)
1F:→ MOONRAKER:他标题取错,+=是VB.NET才有的operator,标题应该是.NET 10/14 00:15