2017年11月21日 星期二

[ VB2010 ] - 011 限定條件重複流程 002

[ VB2010 ] - 限定條件重複流程 002

●在表單上列印出99,97~83,81
○直到滿足條件前置判斷:
○直到滿足條件後置判斷:
○直到不滿足條件判斷:



Public Class Form1

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim I As Integer
        I = 99
        TextBox1.Text = ""
        Do Until I < 81
            TextBox1.Text = TextBox1.Text & CStr(I) & "  "
            I = I - 2
        Loop
    End Sub

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        TextBox2.Text = "●在表單上列印出99,97~83,81"
    End Sub

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        Dim I As Integer
        I = 99
        TextBox1.Text = ""
        Do
            TextBox1.Text = TextBox1.Text & CStr(I) & "  "
            I = I - 2
        Loop Until I < 81
    End Sub

    Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
        Dim I As Integer
        I = 99
        TextBox1.Text = ""
        While I >= 81
            TextBox1.Text = TextBox1.Text & CStr(I) & "  "
            I = I - 2
        End While

    End Sub
End Class

沒有留言:

張貼留言

Messaging API作為替代方案

  LINE超好用功能要沒了!LINE Notify明年3月底終止服務,有什麼替代方案? LINE Notify將於2025年3月31日結束服務,官方建議改用Messaging API作為替代方案。 //CHANNEL_ACCESS_TOKEN = 'Messaging ...