For i = 1 To 4For j = 1 To 4a(i, j) = (i - 1) * 3 + jNext jNext i是给数组a(4,4)赋值。
For i = 3 To 4For j = 3 To 4Print a(j, i);Next jPrintNext i
是只显示a(3 to 4, 3 to 4)的值。
分别是两个嵌套循环,没什么关系呀,后面的i,j你定义其它变量来代替也是一样的呀上面第一个循环是对数组a进行赋值操作
第二个循环是对数组进行输出操作,也就是把上一个循环中得到的运算结果输出到窗体中
Private Sub Command1_Click Dim Temp1 As String Dim Temp2 As Double Dim Sum1 As Double Dim Sum2 As Double Temp1 = InputBox("输入数字") While Temp1 <> "0" And Temp1 <> vbNullString Temp2 = Val(Temp1) If Temp2 > 0 Then Sum1 = Sum1 + Temp2 Else Sum2 = Sum2 - Temp2 End If Wend MsgBox "正数的和为:" & Str(Sum1) MsgBox "负数的和为:" & Str(Sum2)End Sub
5,VB60代码
每按一次command1,i 就默认初值为0,把dim改为static就行了:Private Sub Command1_Click()Static i As Integer i = i + 1 If i > 5 Then MsgBox "登录失败已超过5次" End If If Text1.Text = "asdasdasd" And Text2.Text = "123456" Then MsgBox ("恭喜您,登陆成功!!") End Else MsgBox ("登录失败,请确认是否输入或者正确输入账号密码") End IfEnd Sub我只能把秘密输入两次就提示超过5次登陆代码跟你的有点改动代码如下Dim i As Integerpasswordchr = Text1.TextIf passwordchr = "123456" ThenMsgBox "你输入的秘密正确"ElseMsgBox "你输入的秘密错误"End Ifi = i + 1For i = 0 To iMsgBox "登录失败已超过1次"Next iEnd SubPrivate Sub Command2_Click()Text1.Text = ""End Subprivate sub command1_click()text1.visible = falseend subprivate sub command2_click()text1.visible = truetext1.text = "我是帅哥"text1.fontsize = 18end sub参考一下。