vb6.0 Lesson

Disclaimer: This article is a blogger original article, follow the CC 4.0 BY-SA copyright agreement, reproduced, please attach the original source link and this statement.
This link: https://blog.csdn.net/jywlchuang/article/details/102619719

vb6.0 Lesson

First, the algorithm
main features: there are poor, certainty, feasibility, input, output

Second, the structure of the order of
1, assignment statements
2, InputBox
. 3, MsgBox
. 4, Print

Third, the selection structure
(1) if condition then
statement. 1
the else
statement 2
End IF

(2) if condition then
statement. 1
ELSEIF condition then
statement 2
ELSEIF condition then
statements. 3
...
the else
statement
end if

(3) the SELECT case
the SELECT test case expression
case expression 1
sentence 1
case expression 2
statement 2
...
case the else
statement
end select
such as:

a=val(text1.text)
Select Case a
          Case is = 100
                    Label1.Caption = "优"
          Case is >= 80
                    Label1.Caption = "良"
          Case is >= 60
                    Label1.Caption = "及格"
          Case Else
                    Label1.Caption = "不及格"
End Select

Fourth, the loop structure
. 1, for
for loop variable initial value to a final value of step = step
loop
Exit of
Next loop variable

2, the For each Next
for each array element in the array or collection or collection
loop
Exit for
Next elements in the set or array

   dim myctl as control
   for each myctl  in me.controls   '遍历窗体中的控件
            print  myctl.name              '在窗体中显示控件名称
    next   myctl
    ```
 
 3、do  loop
     do while 条件
     循环体
     exit do
     loop
     当条件为真,执行循环体

4、do  loop while
     do 
     循环体
     exit do
     loop  while 条件
     当条件为真,跳出循环体(即终止循环)

5、do    loop until
     do 
     循环体
     exit do
     loop  until 条件
     当条件为真,跳出循环体(即终止循环)

6、  goto语句
       goto   行号或标签
       
7、复用语句  with    end with
       with  对象
         语句组
        end with
如:
    ```vb
With Form1
   .Caption = "程序设计"
   .BackColor = vbRed
   .Left = 1000
   End With

. 8, Exit
(. 1) do Exit: to exit the "do Loop"
(2) Exit for
(. 3) Exit function
(. 4) Exit SU
(. 5) Exit property: immediate exit from the property in the process include statement.

9、end
(1)end
(2)end function、end if 、end select 、end sub、end type、end with、end property

Guess you like

Origin blog.csdn.net/jywlchuang/article/details/102619719