VB问题~~~~~~~
来源:百度知道 编辑:UC知道 时间:2024/06/11 00:15:10
还有putdata怎么用的
问题1:
放置Text1和Text2还有Command1
添加代码:
Private Function Fib(n As Integer) As Long
Dim res() As Integer
ReDim res(1 To n + 10)
res(1) = 1: res(2) = 1
For i = 3 To n
res(i) = res(i - 1) + res(i - 2)
Next i
Fib = res(n)
End Function
Private Sub Command1_Click()
Dim n As Integer
n = Text1
Text2 = Fib(n)
End Sub
Private Sub Form_Load()
Width = 3300
Height = 2000
Text1.Left = 100
Text1.Top = 100
Text1.Width = 3000
Text1.Height = 300
Text1.Text = ""
Text2.Left = 100
Text2.Top = 500
Text2.Width = 3000
Text2.Height = 300
Text2.Locked = True
Text2.Text = ""
Command1.Left = 1000
Command1.Top = 1000
Command1.Width = 1300
Command1.Height = 500
Command1.Caption = "计算