隔膜式计量泵jmⅩ:vb 杂记

来源:百度文库 编辑:九乡新闻网 时间:2024/10/05 22:03:22
1.TextBox得到焦点   控件名.SetFocus  2.二维数组的长度(行、列)    Dim tmpArray(100, 20) As String
    MsgBox "行长度: " + str(UBound(tmpArray, 1))
    MsgBox "列长度: " + str(UBound(tmpArray, 2))  3.多维    Dim tmpArray(100, 20, 7) As String
    MsgBox "行长度: " + str(UBound(tmpArray, 1))
    MsgBox "列长度: " + str(UBound(tmpArray, 2))
    MsgBox "列长度: " + str(UBound(tmpArray, 3)) 4.判断文件是否存在   Private Declare Function GetDriveType Lib "kernel32" Alias "GetDriveTypeA" (ByVal nDrive As String) As Long   ''
   '' 判断文件是否存在
   '' GetDriveType返回盘符类型,返回值:0-未知的磁盘类型;1-无效的磁盘;2-可移动磁盘;3-固定磁盘;4-网络磁盘;5-光驱;6-RAM
   ''
   Private Function FileExists(filepath As String, filename As String)
     FileExists = False
     If GetDriveType(filepath) <> 5 Then
         If Dir(filepath & filename) <> "" Then
           FileExists = True
         End If
     End If
   End Function 5.删除文件   kill filepath & filename 6.如何在FileListbox控件中显示指定类型的文件   指定文件夹路径:FileListbox1.Path = App.Path   可以用Pattern来显示指定的文件类型:FileListbox1.Pattern = "*.ini"。 7.窗口最大化最小化按钮无效   直接设置MaxButton和MinButton属性为false   --------------------------------------互相学习--------------------------------------