VB常用语法有哪些

来源:学生作业帮助网 编辑:六六作业网 时间:2024/12/19 07:55:34
VB常用语法有哪些VB常用语法有哪些VB常用语法有哪些''Math.Floor()函数舍去小数部分''Math.Ceiling()返回大于或等于指定数字的最小整数.''Math.Round()将值舍入到最接

VB常用语法有哪些
VB常用语法有哪些

VB常用语法有哪些
'Math.Floor()函数 舍去小数部分 'Math.Ceiling() 返回大于或等于指定数字的最小整数. 'Math.Round() 将值舍入到最接近的整数或指定的小数位数. 'MID(str,start,end) str="1234546" MID(str,2,4) 结果 234 Exit语句 用于退出某种控制结构语句的执行 Exit Do ,Exit For ,Exit Sub ,Exit While ,Exit Function ... End语句 独立的End语句用于结束一个程序的运行 With语句 With 对象 With Lable1 语句块 .height=200 End With .width=200 .text="这是一个标签" End With VB中左上角icon图标的载入用代码实现 Form1.Icon = LoadPicture("e:\My Documents\Picture\ICO\1.ico") 'Private m_pointS As Point '声明一个全局变量记录 窗口启动时的坐标 'Private Sub frmStudentExam_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load ' m_pointS = Me.Location '窗口启动时 记录下坐标 'End Sub 'Private Sub frmStudentExam_Move(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Move ' Me.Location = m_pointS '在窗口移动的事件中 设置窗口坐标为启动时的坐标 'End Sub '设置窗体不可改变大小 'Dim strHeight As Single, strWidth As Single 'Private Sub frmStudentExam_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load ' strHeight = 900 ' strWidth = 600 'End Sub 'Private Sub frmStudentExam_Resize(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Resize ' Width = strHeight ' Height = strWidth 'End Sub ''设置窗体不可移动方法 'Const WM_SYSCOMMAND As Integer = &H112 'Private Const SC_MOVE As Integer = &HF010 'Protected Overrides Sub WndProc(ByRef m As Message) ' If m.Msg = WM_SYSCOMMAND AndAlso _ ' (m.WParam.ToInt32() And &HFFF0) = SC_MOVE Then ' m.Result = IntPtr.Zero ' Return ' End If ' MyBase.WndProc(m) 'End Sub