吾爱破解 - 52pojie.cn

 找回密码
 注册[Register]

QQ登录

只需一步,快速开始

查看: 310|回复: 0
收起左侧

[学习记录] vb.net基础 迭代For循环Do循环

[复制链接]
AIabcd 发表于 2024-3-31 11:21
VS2019   x86  vb.net基础
[Visual Basic .NET] 纯文本查看 复制代码
Public Class Form1
    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        Dim iCount As Integer
        For iCount = 0 To 30 Step 5
            'Beep()
            'Threading.Thread.Sleep(3000)
            MsgBox("Sum " & iCount)
        Next
    End Sub

    Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
        Dim iCount As Integer
        Dim stOut As String

        For iCount = 30 To 0 Step -5
            stOut = stOut & iCount & vbNewLine
        Next
        MsgBox(stOut)
    End Sub

    Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click
        Dim x As Integer
        x = 0
        Do While x < 5
            x += 1
            MsgBox("Sum " & x)
        Loop

        x = 0
        Do Until x = 5
            x += 1
            MsgBox("Sum " & x)
        Loop

        x = 0
        Do
            x += 1
            MsgBox("Sum " & x)
        Loop Until x = 5

        x = 0
        Do
            x += 1
            MsgBox("Sum " & x)
        Loop While x < 5
    End Sub
End Class

发帖前要善用论坛搜索功能,那里可能会有你要找的答案或者已经有人发布过相同内容了,请勿重复发帖。

您需要登录后才可以回帖 登录 | 注册[Register]

本版积分规则

返回列表

RSS订阅|小黑屋|处罚记录|联系我们|吾爱破解 - LCG - LSG ( 京ICP备16042023号 | 京公网安备 11010502030087号 )

GMT+8, 2024-11-24 16:59

Powered by Discuz!

Copyright © 2001-2020, Tencent Cloud.

快速回复 返回顶部 返回列表