在按钮单击事件写
创新互联是一家专业的成都网站建设公司,我们专注成都做网站、成都网站建设、成都外贸网站建设、网络营销、企业网站建设,友情链接,广告投放平台为企业客户提供一站式建站解决方案,能带给客户新的互联网理念。从网站结构的规划UI设计到用户体验提高,创新互联力求做到尽善尽美。
dim i,a,b,c
a=1
c=inputbox("请输入平方得个数,例如10")
for i=a to c
b=b+a^2
a=a+1
next i
print b
拖三个textbox,一个button
在窗体上双击button1,在自动生成的button1的Click事件中:
textbox2.text=val(textbox1.text)^2
textbox3.text=val(textbox1.text)^3
Public Function panduan(ByVal n As Integer) As Boolean
Dim res As Boolean = False
Dim a, b, c, d, temp1, temp2 As Integer
a = n \ 1000
b = (n \ 100) Mod 10
c = (n \ 10) Mod 10
d = n Mod 10
temp1 = Sqrt(n)
temp2 = Sqrt(a + b + c + d)
If temp1 * temp1 = n And temp2 * temp2 = (a + b + c + d) Then
res = True
End If
Return res
End Function
Private Sub Button7_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button7.Click
Dim str As String = "", temp As Integer = 0, sum As Integer = 0, x As Integer
For i = 1000 To 9999 Step 1
If panduan(i) Then
temp = i
Exit For
End If
Next
TextBox6.Text = temp
End Sub