精华内容
下载资源
问答
  • VB 常用代码

    2021-07-27 08:43:13
    0 Then Exit Sub ProgressBar1.Max = ProgressMax If Progress <> -1 And Progress 总结 以上是编程之家为你收集整理的VB 常用代码全部内容,希望文章能够帮你解决VB 常用代码所遇到的程序开发问题。 如果觉得编程...

    1. 打开文件对话框

    工程-->部件-->Microsoft Common Dialog Control 6.0

    ImportDialog.InitDir = App.Path '默认打开目录

    ImportDialog.Filter = "文本文件(*.txt)|*.txt|数据文件(*.dat)|*.dat" '文件过滤器

    ImportDialog.ShowOpen '打开对话框

    If Not Len(ImportDialog.FileName) = 0 Then

    Open ImportDialog.FileName For Input As #1

    Do Until EOF(1)

    Line Input #1,newURL

    Loop

    Close #1

    End If

    2.回车换行符

    vbCrLf 是VB回车换行符

    chr(10) & chr(13)

    用 vbCrLf 会空出一行,用chr(13)就正好

    3. 数组长度

    用ubound()函数知道数组的上限,lbound()函数知道数组的下限,ubound()-lbound()+1就是数组元素的个数

    例如:

    dim a(10) as long

    dim nLen as long

    nLen = ubound(a) - lbound(a) + 1 '这里上限是10,下限是0,结果是11

    4. WebBrowser控件下载进度条

    进度条ProgressBar控件:工程-部件-MicroSoft Windows Common Controls 6.0

    Private Sub WebBrowser1_ProgressChange(ByVal Progress As Long,ByVal ProgressMax As Long)

    If ProgressMax = 0 Then Exit Sub

    ProgressBar1.Max = ProgressMax

    If Progress <> -1 And Progress <= ProgressMax Then

    ProgressBar1.Value = Progress

    End If

    End Sub

    总结

    以上是编程之家为你收集整理的VB 常用代码全部内容,希望文章能够帮你解决VB 常用代码所遇到的程序开发问题。

    如果觉得编程之家网站内容还不错,欢迎将编程之家网站推荐给程序员好友。

    本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。

    展开全文
  • vb键盘代码

    2021-01-20 19:25:44
    键码 常数 值 描述 vbKeyLButton 1 鼠标左键 vbKeyRButton 2 鼠标右键 vbKeyCancel 3 CANCEL vbKeyMButton 4 鼠标中键 vbKeyBack 8 BACKSPACE vbKeyTab 9 TAB vbKeyClear ...菜单键

    键码

    常数描述
    vbKeyLButton1鼠标左键
    vbKeyRButton2鼠标右键
    vbKeyCancel3CANCEL
    vbKeyMButton4鼠标中键
    vbKeyBack8BACKSPACE
    vbKeyTab9TAB
    vbKeyClear12CLEAR
    vbKeyReturn13ENTER
    vbKeyShift16SHIFT
    vbKeyControl17CTRL
    vbKeyMenu18菜单键
    vbKeyPause19PAUSE
    vbKeyCapital20CAPS LOCK
    vbKeyEscape27ESC
    vbKeySpace32SPACEBAR
    vbKeyPageUp33PAGEUP
    vbKeyPageDown34PAGEDOWN
    vbKeyEnd35END
    vbKeyHome36HOME
    vbKeyLeft37LEFT ARROW
    vbKeyUp38UP ARROW
    vbKeyRight39RIGHT ARROW
    vbKeyDown40DOWN ARROW
    vbKeySelect41SELECT
    vbKeyPrint42PRINT SCREEN
    vbKeyExecute43EXECUTE
    vbKeySnapshot44SNAP SHOT
    vbKeyInser45INS
    vbKeyDelete46DEL
    vbKeyHelp47HELP
    vbKeyNumlock144NUM LOCK

    A 键到 Z 键与其 ASCII 码的相应值’A’ 到 ‘Z’ 是一致的

    常数描述
    vbKeyA65A
    vbKeyB66B
    vbKeyC67C
    vbKeyD68D
    vbKeyE69E
    vbKeyF70F
    vbKeyG71G
    vbKeyH72H
    vbKeyI73I
    vbKeyJ74J
    vbKeyK75K
    vbKeyL76L
    vbKeyM77M
    vbKeyN78N
    vbKeyO79O
    vbKeyP80P
    vbKeyQ81Q
    vbKeyR82R
    vbKeyS83S
    vbKeyT84T
    vbKeyU85U
    vbKeyV86V
    vbKeyW87W
    vbKeyX88X
    vbKeyY89Y
    vbKeyZ90Z

    0 键到 9 键与其 ASCII 码的相应值 ‘0’ 到 ‘9’ 是一致的

    常数描述
    vbKey0480
    vbKey1491
    vbKey2502
    vbKey3513
    vbKey4524
    vbKey5535
    vbKey6546
    vbKey7557
    vbKey8568
    vbKey9579

    数字小键盘上的键

    常数描述
    vbKeyNumpad0960
    vbKeyNumpad1971
    vbKeyNumpad2982
    vbKeyNumpad3993
    vbKeyNumpad41004
    vbKeyNumpad51015
    vbKeyNumpad61026
    vbKeyNumpad71037
    vbKeyNumpad81048
    vbKeyNumpad91059
    vbKeyMultiply106乘号 (*)
    vbKeyAdd107加号 (+)
    vbKeySeparator108ENTER (在数字小键盘上)
    vbKeySubtract109减号 (-)
    vbKeyDecimal110小数点 (.)
    vbKeyDivide111除号 (/)

    功能键

    常数描述
    vbKeyF1112F1
    vbKeyF2113F2
    vbKeyF3114F3
    vbKeyF4115F4
    vbKeyF5116F5
    vbKeyF6117F6
    vbKeyF7118F7
    vbKeyF8119F8
    vbKeyF9120F9
    vbKeyF10121F10
    vbKeyF11122F11
    vbKeyF12123F12
    vbKeyF13124F13
    vbKeyF14125F14
    vbKeyF15126F15
    vbKeyF16127F16
    展开全文
  • vb 万年历 代码

    2021-09-08 11:59:58
    VERSION 5.00 Begin VB.Form Form2 Caption = "万年历" ClientHeight = 7035 ClientLeft = 4485 ClientTop = 3675 ClientWidth = 8025 LinkTopic = "Form2" MaxButton = 0 'False ScaleHeight .
    VERSION 5.00
    Begin VB.Form Form2 
       Caption         =   "万年历"
       ClientHeight    =   7035
       ClientLeft      =   4485
       ClientTop       =   3675
       ClientWidth     =   8025
       LinkTopic       =   "Form2"
       MaxButton       =   0   'False
       ScaleHeight     =   7035
       ScaleWidth      =   8025
       Begin VB.Frame Frame1 
          Caption         =   "检索"
          Height          =   735
          Left            =   1200
          TabIndex        =   23
          Top             =   4920
          Width           =   5055
          Begin VB.CommandButton Command5 
             Caption         =   "确定"
             Height          =   375
             Left            =   4320
             TabIndex        =   25
             Top             =   240
             Width           =   615
          End
          Begin VB.TextBox Text4 
             Height          =   375
             Left            =   120
             TabIndex        =   24
             Top             =   240
             Width           =   4095
          End
       End
       Begin VB.PictureBox Picture1 
          Height          =   3735
          Left            =   1200
          ScaleHeight     =   3675
          ScaleWidth      =   4995
          TabIndex        =   11
          Top             =   1080
          Width           =   5055
          Begin VB.Label Label16 
             AutoSize        =   -1  'True
             Caption         =   " "
             ForeColor       =   &H8000000D&
             Height          =   180
             Index           =   0
             Left            =   350
             TabIndex        =   26
             Top             =   1000
             Width           =   90
          End
          Begin VB.Label Label14 
             AutoSize        =   -1  'True
             Caption         =   " "
             ForeColor       =   &H000000C0&
             Height          =   255
             Index           =   0
             Left            =   480
             TabIndex        =   21
             Top             =   740
             Width           =   90
          End
          Begin VB.Label Label12 
             Caption         =   "六"
             Height          =   255
             Left            =   4560
             TabIndex        =   19
             Top             =   240
             Width           =   255
          End
          Begin VB.Label Label11 
             Caption         =   "五"
             Height          =   255
             Left            =   3840
             TabIndex        =   18
             Top             =   240
             Width           =   255
          End
          Begin VB.Label Label9 
             Caption         =   "四"
             Height          =   255
             Left            =   3120
             TabIndex        =   17
             Top             =   240
             Width           =   255
          End
          Begin VB.Label Label10 
             Caption         =   "Label10"
             Height          =   15
             Left            =   2520
             TabIndex        =   16
             Top             =   600
             Width           =   375
          End
          Begin VB.Label Label8 
             Caption         =   "三"
             Height          =   255
             Left            =   2400
             TabIndex        =   15
             Top             =   240
             Width           =   255
          End
          Begin VB.Label Label7 
             Caption         =   "二"
             Height          =   255
             Left            =   1680
             TabIndex        =   14
             Top             =   240
             Width           =   255
          End
          Begin VB.Label Label6 
             Caption         =   "一"
             Height          =   255
             Left            =   960
             TabIndex        =   13
             Top             =   240
             Width           =   255
          End
          Begin VB.Label Label5 
             Caption         =   "日"
             Height          =   255
             Left            =   240
             TabIndex        =   12
             Top             =   240
             Width           =   255
          End
          Begin VB.Line Line1 
             X1              =   7440
             X2              =   7440
             Y1              =   3000
             Y2              =   0
          End
          Begin VB.Line Line2 
             X1              =   0
             X2              =   7440
             Y1              =   0
             Y2              =   0
          End
          Begin VB.Line Line3 
             X1              =   0
             X2              =   5160
             Y1              =   720
             Y2              =   720
          End
          Begin VB.Line Line4 
             X1              =   0
             X2              =   5160
             Y1              =   1200
             Y2              =   1200
          End
          Begin VB.Line Line5 
             X1              =   0
             X2              =   5160
             Y1              =   1680
             Y2              =   1680
          End
          Begin VB.Line Line6 
             X1              =   0
             X2              =   5160
             Y1              =   2160
             Y2              =   2160
          End
          Begin VB.Line Line7 
             X1              =   0
             X2              =   5160
             Y1              =   2640
             Y2              =   2640
          End
          Begin VB.Line Line8 
             X1              =   0
             X2              =   5160
             Y1              =   3120
             Y2              =   3120
          End
          Begin VB.Line Line9 
             X1              =   0
             X2              =   5160
             Y1              =   3600
             Y2              =   3600
          End
          Begin VB.Line Line10 
             X1              =   720
             X2              =   720
             Y1              =   0
             Y2              =   3600
          End
          Begin VB.Line Line11 
             X1              =   1440
             X2              =   1440
             Y1              =   0
             Y2              =   3600
          End
          Begin VB.Line Line12 
             X1              =   2160
             X2              =   2160
             Y1              =   0
             Y2              =   3600
          End
          Begin VB.Line Line13 
             X1              =   2880
             X2              =   2880
             Y1              =   0
             Y2              =   3600
          End
          Begin VB.Line Line14 
             X1              =   3600
             X2              =   3600
             Y1              =   0
             Y2              =   3600
          End
          Begin VB.Line Line15 
             X1              =   4320
             X2              =   4320
             Y1              =   0
             Y2              =   3600
          End
          Begin VB.Label Label13 
             Height          =   255
             Index           =   0
             Left            =   120
             TabIndex        =   20
             Top             =   720
             Width           =   255
          End
          Begin VB.Label Label15 
             AutoSize        =   -1  'True
             Height          =   180
             Index           =   0
             Left            =   0
             TabIndex        =   22
             Top             =   1020
             Width           =   90
          End
       End
       Begin VB.Timer Timer1 
          Interval        =   1000
          Left            =   7440
          Top             =   480
       End
       Begin VB.CommandButton Command4 
          Caption         =   "退出"
          Height          =   735
          Left            =   6360
          TabIndex        =   10
          Top             =   6120
          Width           =   1215
       End
       Begin VB.CommandButton Command3 
          Caption         =   "今天"
          Height          =   495
          Left            =   120
          TabIndex        =   9
          Top             =   240
          Width           =   615
       End
       Begin VB.CommandButton Command2 
          Caption         =   ">"
          BeginProperty Font 
             Name            =   "宋体"
             Size            =   12
             Charset         =   134
             Weight          =   700
             Underline       =   0   'False
             Italic          =   0   'False
             Strikethrough   =   0   'False
          EndProperty
          Height          =   495
          Left            =   5760
          TabIndex        =   7
          Top             =   240
          Width           =   495
       End
       Begin VB.CommandButton Command1 
          Caption         =   "<"
          BeginProperty Font 
             Name            =   "宋体"
             Size            =   12
             Charset         =   134
             Weight          =   700
             Underline       =   0   'False
             Italic          =   0   'False
             Strikethrough   =   0   'False
          EndProperty
          Height          =   495
          Left            =   960
          TabIndex        =   6
          Top             =   240
          Width           =   495
       End
       Begin VB.TextBox Text3 
          Enabled         =   0   'False
          Height          =   375
          Left            =   4560
          TabIndex        =   2
          Top             =   360
          Width           =   495
       End
       Begin VB.TextBox Text2 
          Enabled         =   0   'False
          Height          =   375
          Left            =   3240
          TabIndex        =   1
          Top             =   360
          Width           =   495
       End
       Begin VB.TextBox Text1 
          Enabled         =   0   'False
          Height          =   375
          Left            =   2040
          TabIndex        =   0
          Top             =   360
          Width           =   615
       End
       Begin VB.Label Label4 
          BeginProperty Font 
             Name            =   "黑体"
             Size            =   15
             Charset         =   134
             Weight          =   700
             Underline       =   0   'False
             Italic          =   0   'False
             Strikethrough   =   0   'False
          EndProperty
          Height          =   615
          Left            =   240
          TabIndex        =   8
          Top             =   6120
          Width           =   3375
       End
       Begin VB.Label Label3 
          Caption         =   "日"
          Height          =   375
          Left            =   5280
          TabIndex        =   5
          Top             =   480
          Width           =   375
       End
       Begin VB.Label Label2 
          Caption         =   "月"
          Height          =   375
          Left            =   4080
          TabIndex        =   4
          Top             =   480
          Width           =   375
       End
       Begin VB.Label Label1 
          Caption         =   "年"
          Height          =   375
          Left            =   2760
          TabIndex        =   3
          Top             =   480
          Width           =   375
       End
    End
    Attribute VB_Name = "Form2"
    Attribute VB_GlobalNameSpace = False
    Attribute VB_Creatable = False
    Attribute VB_PredeclaredId = True
    Attribute VB_Exposed = False
    
    Private Sub Command1_Click()
        Dim datey As Date, m As Date
        Dim i As Integer, j As Integer, x As Integer, k As Integer
        Dim Li19000101 As Long
        j = 1
        Text2.Text = Right("0" & Val(Text2.Text - 1), 2)
        If Text2.Text = 0 Then
            Text2.Text = 12
            Text1.Text = Text1.Text - 1
        End If
    
        datey = DateSerial(Val(Text1.Text), Val(Text2.Text), 1)
    
        k = Weekday(datey) - 1         'k
        m = DateAdd("m", 1, datey)
        x = DateDiff("d", datey, m)    'X
        Li19000101 = DateDiff("d", 1900 - 1 - 1#, datey) Mod 6
    
        Now1 = DateAdd("h", 8, Now)
    
        If Val(Text1.Text) = Year(Now1) And Val(Text2.Text) = Month(Now1) Then
            For i = 0 To 41
                Label15(i).Caption = " "
                Label16(i).Caption = "   "
                If i >= k And j <= x Then
                    Label13(i).Caption = j
                    Label14(i).Caption = "休"
                    Label14(i).ForeColor = &HC000&
                    If Li19000101 = 0 Or Li19000101 = 5 Then
                        Label14(i).Caption = "全"
                        Label14(i).ForeColor = &HC0&
                    End If
    
                    Label15(i).Caption = "●"
                    Label15(i).ForeColor = &HC0C0C0
                    If Trim(读日志(Text1 & Text2, Str(i))) <> "" Then    '说明有内容
                        Label15(i).ForeColor = &HC0C0&
                        Label15(i).ToolTipText = Trim(读日志(Text1 & Text2, Str(i)))
                    End If
    
                    If Trim(读农历(Text1 & Text2, Str(i))) <> "" Then    '说明有内容
                        Label16(i).Caption = Trim(读农历(Text1 & Text2, Str(i)))
                    End If
    
                    If j = Day(Now1) Then
                        Label13(i).Font.Underline = True
                    End If
                    j = j + 1
                    Li19000101 = (Li19000101 + 1) Mod 6
                Else
                    Label13(i).Caption = " "
                    Label14(i).Caption = " "
                    Label15(i).Caption = " "
                    Label16(i).Caption = "   "
                End If
    
    
            Next i
        Else
            For i = 0 To 41
                Label14(i).Caption = ""
                Label15(i).Caption = " "
                Label16(i).Caption = "   "
                If i >= k And j <= x Then
                    If Trim(读日志(Text1 & Text2, "偏移")) = "" Then
                        写日志 Text1 & Text2, "偏移", Str(i - 1)
                    End If
    
                    Label13(i).Caption = j
                    Label14(i).Caption = "休"
                    Label14(i).ForeColor = &HC000&
                    If Li19000101 = 0 Or Li19000101 = 5 Then
                        Label14(i).Caption = "全"
                        Label14(i).ForeColor = &HC0&
                    End If
    
                    Label15(i).Caption = "●"
                    Label15(i).ForeColor = &HC0C0C0
                    If Trim(读日志(Text1 & Text2, Str(i))) <> "" Then    '说明有内容
                        Label15(i).ForeColor = &HC0C0&
                        Label15(i).ToolTipText = Trim(读日志(Text1 & Text2, Str(i)))
                    End If
    
                    If Trim(读农历(Text1 & Text2, Str(i))) <> "" Then    '说明有内容
                        Label16(i).Caption = Trim(读农历(Text1 & Text2, Str(i)))
                    End If
    
                    Label13(i).Font.Underline = False
                    j = j + 1
                    Li19000101 = (Li19000101 + 1) Mod 6
                Else
                    Label13(i).Caption = " "
                    Label14(i).Caption = " "
                    Label15(i).Caption = " "
                    Label16(i).Caption = "   "
                End If
    
            Next i
        End If
    
    End Sub
    
    Private Sub Command2_Click()
        Dim datey As Date, m As Date
        Dim i As Integer, j As Integer, x As Integer, k As Integer
        Dim Li19000101 As Long
        j = 1
    
        Text2.Text = Right("0" & Val(Text2.Text + 1), 2)
    
        If Text2.Text = 12 Then
            Text2.Text = 0 + 1
            Text1.Text = Text1.Text + 1
        End If
        If Len(Text2.Text) = 1 Then Text2 = "0" & Text2
        datey = DateSerial(Val(Text1.Text), Val(Text2.Text), 1)
        k = Weekday(datey) - 1         'k
        m = DateAdd("m", 1, datey)
        x = DateDiff("d", datey, m)    'X
    
        Li19000101 = DateDiff("d", 1900 - 1 - 1#, datey) Mod 6
        Now1 = DateAdd("h", 8, Now)
        If Val(Text1.Text) = Year(Now1) And Val(Text2.Text) = Month(Now1) Then
            For i = 0 To 41
            Label15(i).Caption = " "
                Label16(i).Caption = "   "
                If i >= k And j <= x Then
                    Label13(i).Caption = j
                    Label14(i).Caption = "休"
                    Label14(i).ForeColor = &HC000&
                    If Li19000101 = 0 Or Li19000101 = 5 Then
                        Label14(i).Caption = "全"
                        Label14(i).ForeColor = &HC0&
                    End If
                    Label15(i).Caption = "●"
                    Label15(i).ForeColor = &HC0C0C0
                    If Trim(读日志(Text1 & Text2, Str(i))) <> "" Then    '说明有内容
                        Label15(i).ForeColor = &HC0C0&
                        Label15(i).ToolTipText = Trim(读日志(Text1 & Text2, Str(i)))
                    End If
                    
                    If Trim(读农历(Text1 & Text2, Str(i))) <> "" Then    '说明有内容
                        Label16(i).Caption = Trim(读农历(Text1 & Text2, Str(i)))
                    End If
                    
                    If j = Day(Now1) Then
                        Label13(i).Font.Underline = True
                    End If
                    j = j + 1
                    Li19000101 = (Li19000101 + 1) Mod 6
                Else
                   Label13(i).Caption = " "
                    Label14(i).Caption = " "
                    Label15(i).Caption = " "
                    Label16(i).Caption = "   "
                End If
    
            Next i
        Else
            For i = 0 To 41
                Label14(i).Caption = ""
                Label15(i).Caption = " "
                Label16(i).Caption = "   "
                
                If i >= k And j <= x Then
                    If Trim(读日志(Text1 & Text2, "偏移")) = "" Then
                        写日志 Text1 & Text2, "偏移", Str(i - 1)
                    End If
                    Label13(i).Caption = j
                    Label14(i).Caption = "休"
                    Label14(i).ForeColor = &HC000&
                    If Li19000101 = 0 Or Li19000101 = 5 Then
                        Label14(i).Caption = "全"
                        Label14(i).ForeColor = &HC0&
                    End If
                    Label15(i).Caption = "●"
                    Label15(i).ForeColor = &HC0C0C0
                    If Trim(读日志(Text1 & Text2, Str(i))) <> "" Then    '说明有内容
                        Label15(i).ForeColor = &HC0C0&
                        Label15(i).ToolTipText = Trim(读日志(Text1 & Text2, Str(i)))
                    End If
                    
                    If Trim(读农历(Text1 & Text2, Str(i))) <> "" Then    '说明有内容
                        Label16(i).Caption = Trim(读农历(Text1 & Text2, Str(i)))
                    End If
                    
                    Label13(i).Font.Underline = False
                    j = j + 1
                    Li19000101 = (Li19000101 + 1) Mod 6
                Else
                    Label13(i).Caption = " "
                    Label14(i).Caption = " "
                    Label15(i).Caption = " "
                    Label16(i).Caption = "   "
                End If
    
            Next i
        End If
    
     
    
    End Sub
    
    Private Sub Command3_Click()
        Dim datey As Date, m As Date
        Dim i As Integer, j As Integer, x As Integer, k As Integer
        j = 1
        Now1 = DateAdd("h", 8, Now)
        Label4.Caption = Now1
    
        Text1.Text = Year(Now1)
        Text2.Text = Month(Now1)
        If Len(Text2) = 1 Then Text2 = "0" & Text2
        Text3.Text = Day(Now1)
        If Len(Text3) = 1 Then Text3 = "0" & Text3
        datey = DateSerial(Val(Text1.Text), Val(Text2.Text), 1)
    
        k = Weekday(datey) - 1         'k
        m = DateAdd("m", 1, datey)
        x = DateDiff("d", datey, m)    'X
        For i = 0 To 41
            If i >= k And j <= x Then
                Label13(i).Caption = j
                j = j + 1
            Else
                Label13(i).Caption = " "
            End If
        Next i
    
    End Sub
    
    Private Sub Command4_Click()
        End
    End Sub
    
    Private Sub Command5_Click()
    '对1900年至2100年之间所有日期的项取值,
    '对取到的值与文本框4比较,如果包括则给出日期
        Dim y As Integer
        Dim m As Integer
        Dim d As Integer
        Dim i As Integer
        Dim ss As String
    
    
        If Len(Trim(Text4)) = 0 Then
            MsgBox "检索内容为空,无法查找"
            Exit Sub
        End If
    
        For y = 2020 To 2025
            For m = 1 To 12
                Dim mm As String
                If m < 10 Then
                    mm = "0" & m
                Else
                    mm = m
                End If
    
                If Trim(读日志(Trim(Str(y)) & mm, "偏移")) = "" Then
                    '如果没有偏移信息则什么也不做
                Else
                    i = Val(Trim(读日志(Trim(Str(y)) & mm, "偏移")))
    
    
    
                    For d = 0 To 41
                        Dim s As String
                        Dim c As Integer
                        s = Trim(读日志(Str(y) & mm, Trim(Str(d))))
                        c = InStr(s, Trim(Text4))
                        If c > 0 Then
                            ss = ss & y & "年" & (mm) & "月" & (d - i) & "日:" & s & vbCrLf
                        End If
                    Next
                End If
            Next
        Next
        If ss <> "" Then MsgBox ss, , "结果" Else MsgBox "没有符合的内容", , "结果"
        Text4 = ""
    End Sub
    
    Private Sub Form_Load()
        Dim m As String
        Dim datex As Date
        Dim i As Integer, j As Integer, x As Integer
        Dim Li19000101 As Long
        j = 1
        Me.Show
        Now1 = DateAdd("h", 8, Now)
        Label4.Caption = Now1
        Text1.Text = Year(Now1)
        Text2.Text = Right("0" & Month(Now1), 2)
        Text3.Text = Right("0" & Day(Now1), 2)
    
        datex = Date - Day(Now1) + 1
        k = Weekday(datex) - 1         'k
        m = DateAdd("m", 1, datex)
        x = DateDiff("d", datex, m)    'X 算出当前月有多少天
    
        Li19000101 = DateDiff("d", 1900 - 1 - 1#, datex) Mod 6
    
        For i = 1 To 41
    
            '13标签
            Load Label13(i)
            Label13(i).Left = (i Mod 7) * 720 + 40
            Label13(i).Top = (i \ 7) * 480 + 750
            Label13(i).Caption = ""
            Label13(i).Visible = True
    
            '14标签
            Load Label14(i)
            Label14(i).Left = (i Mod 7) * 720 + 440
            Label14(i).Top = (i \ 7) * 480 + 750
            Label14(i).Caption = ""
            Label14(i).Visible = True
    
            '15标签
            Load Label15(i)
            Label15(i).Left = (i Mod 7) * 720 + 40
            Label15(i).Top = (i \ 7) * 480 + 1000
            Label15(i).Caption = ""
            Label15(i).Visible = True
    
            '16标签
            Load Label16(i)
            Label16(i).Left = (i Mod 7) * 720 + 320
            Label16(i).Top = (i \ 7) * 480 + 1000
            Label16(i).Caption = "    "
            Label16(i).Visible = True
    
        Next i
    
        y = Day(Now1)
        For i = 0 To 41
            If i >= k And j <= x Then
    
                If Trim(读日志(Text1 & Text2, "偏移")) = "" Then
                    写日志 Text1 & Text2, "偏移", Str(i - 1)
                End If
    
                Label13(i).Caption = j
    
                Label14(i).Caption = "休"
                Label14(i).ForeColor = &HC000&
                If Li19000101 = 0 Or Li19000101 = 5 Then
                    Label14(i).Caption = "全"
                    Label14(i).ForeColor = &HC0&
                End If
    
                Label15(i).Caption = "●"
                Label15(i).ForeColor = &HC0C0C0
                If Trim(读日志(Text1 & Text2, Str(i))) <> "" Then    '说明有内容
                    Label15(i).ForeColor = &HC0C0&
                    Label15(i).ToolTipText = Trim(读日志(Text1 & Text2, Str(i)))
                End If
    
                If Trim(读农历(Text1 & Text2, Str(i))) <> "" Then    '说明有内容
                    Label16(i).Caption = Trim(读农历(Text1 & Text2, Str(i)))
                End If
    
                If j = Day(Now1) Then
                    Label13(i).Font.Underline = True
                End If
                j = j + 1
                Li19000101 = (Li19000101 + 1) Mod 6
            End If
        Next i
    
    End Sub
    
    Private Sub Label15_Click(Index As Integer)
        Dim 年月 As String, 值 As String, s As String
        年月 = Text1 & Text2
    
        If Trim(读日志(年月, Str(Index))) <> "" Then    '说明有内容
            s = Trim(读日志(年月, Str(Index)))
            值 = InputBox("请输入日志内容", "日志信息", s)
        Else
            值 = InputBox("请输入日志内容", "", "")
        End If
    
    
        If 值 = "" Then Exit Sub
        If 值 = " " Then
            值 = ""
            Label15(Index).ToolTipText = ""
        End If
    
        写日志 年月, Str(Index), 值
        刷新
    End Sub
    
    Private Sub Label16_dblClick(Index As Integer)
        Dim 年月 As String, 值 As String, s As String
        年月 = Text1 & Text2
    
        If Trim(读农历(年月, Str(Index))) <> "" Then    '说明有内容
            s = Trim(读农历(年月, Str(Index)))
            值 = InputBox("请输入农历内容", "农历信息", s)
        Else
            值 = InputBox("请输入农历内容", "", "")
        End If
    
    
        If 值 = "" Then Exit Sub
        If 值 = " " Then
            值 = ""
        End If
    
        写农历 年月, Str(Index), 值
        刷新
    End Sub
    
    Private Sub Timer1_Timer()
        Now1 = DateAdd("h", 8, Now)
        Label4.Caption = Now1
    End Sub
    
    Private Sub 刷新()
        Dim datey As Date, m As Date
        Dim i As Integer, j As Integer, x As Integer, k As Integer
        Dim Li19000101 As Long
        j = 1
        If Len(Text2.Text) = 1 Then Text2 = "0" & Text2
        datey = DateSerial(Val(Text1.Text), Val(Text2.Text), 1)
        k = Weekday(datey) - 1         'k
        m = DateAdd("m", 1, datey)
        x = DateDiff("d", datey, m)    'X
    
        Li19000101 = DateDiff("d", 1900 - 1 - 1#, datey) Mod 6
        Now1 = DateAdd("h", 8, Now)
        If Val(Text1.Text) = Year(Now1) And Val(Text2.Text) = Month(Now1) Then
            For i = 0 To 41
                If i >= k And j <= x Then
                    Label13(i).Caption = j
                    Label14(i).Caption = "休"
                    Label14(i).ForeColor = &HC000&
                    If Li19000101 = 0 Or Li19000101 = 5 Then
                        Label14(i).Caption = "全"
                        Label14(i).ForeColor = &HC0&
                    End If
                    Label15(i).Caption = "●"
                    Label15(i).ForeColor = &HC0C0C0
                    If Trim(读日志(Text1 & Text2, Str(i))) <> "" Then    '说明有内容
                        Label15(i).ForeColor = &HC0C0&
                        Label15(i).ToolTipText = Trim(读日志(Text1 & Text2, Str(i)))
                    End If
                    If Trim(读农历(Text1 & Text2, Str(i))) <> "" Then    '说明有内容
                        Label16(i).Caption = Trim(读农历(Text1 & Text2, Str(i)))
                    End If
    
                    If j = Day(Now1) Then
                        Label13(i).Font.Underline = True
                    End If
                    j = j + 1
                    Li19000101 = (Li19000101 + 1) Mod 6
                Else
                    Label13(i).Caption = " "
                    Label14(i).Caption = " "
                End If
    
            Next i
        Else
            For i = 0 To 41
                Label14(i).Caption = ""
                If i >= k And j <= x Then
                    Label13(i).Caption = j
                    Label14(i).Caption = "休"
                    Label14(i).ForeColor = &HC000&
                    If Li19000101 = 0 Or Li19000101 = 5 Then
                        Label14(i).Caption = "全"
                        Label14(i).ForeColor = &HC0&
                    End If
                    Label15(i).Caption = "●"
                    Label15(i).ForeColor = &HC0C0C0
                    If Trim(读日志(Text1 & Text2, Str(i))) <> "" Then    '说明有内容
                        Label15(i).ForeColor = &HC0C0&
                        Label15(i).ToolTipText = Trim(读日志(Text1 & Text2, Str(i)))
                    End If
                    If Trim(读农历(Text1 & Text2, Str(i))) <> "" Then    '说明有内容
                        Label16(i).Caption = Trim(读农历(Text1 & Text2, Str(i)))
                    End If
                    Label13(i).Font.Underline = False
                    j = j + 1
                    Li19000101 = (Li19000101 + 1) Mod 6
                Else
                    Label13(i).Caption = " "
                    Label14(i).Caption = " "
                    Label15(i).Caption = " "
                End If
    
            Next i
        End If
    
    End Sub
    
    

    展开全文
  • 杨辉三角vb代码

    2020-12-20 18:53:59
    PrivateSubCommand1_Click()ClsDimx()n=Val(InputBox(""))ReDimx(n,n)Fori=1Tonx(i,1)=1:x(i,i)=1NextiFori=2TonForj=1Toi-1x(i,j)=x(i-1,j-1)+x(i-1,j)NextjNextiF...

    Private Sub Command1_Click()

    Cls

    Dim x()

    n = Val(InputBox(""))

    ReDim x(n, n)

    For i = 1 To n

    x(i, 1) = 1: x(i, i) = 1

    Next i

    For i = 2 To n

    For j = 1 To i - 1

    x(i, j) = x(i - 1, j - 1) + x(i - 1, j)

    Next j

    Next i

    For i = 1 To n

    Print String(5 * (n - i), " ");

    For j = 1 To i

    s = ""

    For k = 5 - Len(LTrim(Str(x(i, j)))) To 1 Step -1

    s = s & " "

    Next k

    s = s & LTrim(Str(x(i, j))) & String(5, " ")

    Print s;

    Next j

    Print

    Next i

    End Sub

    展开全文
  • 科学计算器vb代码

    2021-07-29 03:45:17
    《科学计算器vb代码》由会员分享,可在线阅读,更多相关《科学计算器vb代码(30页珍藏版)》请在人人文库网上搜索。1、用VB写计算器似乎有很多例子,这个代码就是其中之一,科学计算器是在基本计算器的基础上,加入...
  • vb代码里如何换行啊?在VB中,当一行代码太长时,语句可能会中断。规则是,空格下划线。例如aaaaaa bbbb应该在中间断开AB,AAAA如果你想让自己的文本显示换行符,可以在文件中间添加CH(13)来实现这个功能。vb中怎么...
  • 快速排序vb代码

    2020-12-27 12:17:34
    快速排序vb代码: Dim a() As Integer '定义一个动态数组 Sub qsort(a() As Integer, ByVal kaishi As Integer, ByVal jieshu As Integer) Dim temp As Integer, j As Integer, i As Integer i = kaishi: j = jieshu...
  • vb文本框字体加粗 vb字体加粗代码

    千次阅读 2021-01-13 18:06:15
    怎么改变VB中文本框字体颜色?为所选颜色上色。要使用此属性,必须首先将flags属性设置为cdlccfeffects。Fontbold是否选择了粗体。Fontitalics是否选择了斜体。Fontstrikethru是否选择了删除线。Fontunderline是否...
  • vb简单的计算机源代码》由会员分享,可在线阅读,更多相关《vb简单的计算机源代码(9页珍藏版)》请在人人文库网上搜索。1、vb简单的计算机源代码.txt如果青春的时光在闲散中度过,那么回忆岁月将是一场凄凉的悲剧。...
  • 文档介绍:大学计算机二级考试常用vb代码.docx参考代码如下:mand1_Click()Textl.Text=””IfCheckl.Value=1ThenTextl.Text=Checkl.CaptionEndIfIfCheck2.Value=1ThenTextl.Text=Textl.Text+Check2....
  • 展开全部Text1.FontItalic = True字体相关设置代码:1、设置具体字号:text1.FontSize = "45" ps:双引号内的字号可以随意更改;或者是每点击一次加大一32313133353236313431303231363533e78988e69d8331333431373864...
  • 我有一个具有开始按钮的表单(允许用户根据需要反复运行进程),并且我想在表单加载时发送btnStart.Click事件,以便进程自动启动....我试过非常简单,基本上可行.但是,Visual Studio给我一个警告变量’sender’在被赋值之前...
  • vb代码打开网页,打开一个网站的功能用API来做实在是太容易了,就是用ShellExecute函数来完成,只要一行代码,而且VB用ShellExecute也可以轻易打开EXE程序,音乐,视频,txt文件,邮件软件等等...先在窗体写下API...
  • 该楼层疑似违规已被系统折叠隐藏此楼查看此楼刚写的渣代码......太冗余了....Private Sub Check1斜体_Click()If Check1斜体.Value = 1 ThenText1.FontItalic = TrueElse: Text1.FontItalic = FalseEnd IfEnd Sub...
  • VB的程序代码是允许换行书写的,只要在每次换行的最后一个字符加上换行字符“_”就可以了。例如:Sub PicMove()Frm.Picture2.Left = Frm.Picture1.Left + _ ’加上换行符Frm.Picture1.WidthEnd Sub2、 如何在设计的...
  • VB编程字体的代码

    2020-12-31 09:25:35
    PrivateSubForm_Load()Combo1.AddItem"一号"Combo1.AddItem"二号"Combo1.AddItem"小二"Combo1.AddItem"三号"Combo1.AddItem"小三"Combo1.AddItem"四号"Combo1.AddItem"小四"Combo1.AddItem"五号"Combo1.AddItem"小五...
  • 科学计算器vb代码.doc

    2021-06-18 07:30:03
    科学计算器vb代码.doc (19页) 本资源提供全文预览,点击全文预览即可全文预览,如果喜欢文档就下载吧,查找使用更方便哦!14.90 积分· 用VB写计算器似乎有很多例子,这个代码就是其中之一,科学计算器是在基本...
  • 彩票程序(用VB6.0源代码编写)彩票程序(用VB6.0源代码编写)抽取随机生成的并计算抽奖次数.vb彩票工具用vb制成的vb绘制工具用vb制成的vb绘制工具用vb制成的vb绘制工具用vb制成的vb绘制工具用vb制成的vb绘制工具用VB编....
  • )下表显示code128的转换代码与三个子集的起始代码。替代码十进制值a子集字符b子集字符c子集字符 ><62 >030>> >=94~ >195usqdel >296fnc3fnc3 >397fnc2fnc2 >498shiftshift >599code ccode c >6100code bfnc4code b ...
  • 简单易懂,不忍删章去节,作为引32313133353236313431303231363533e4b893e5b19e31333262373935子:Access数据库与ADODB编程入门即然已经了解了那些数据库中的基本概念,那么我们就只说说在VB中使用数据库编程首先有...
  • 雅各布没有任何问题,它的工作方式与广告一样.首先,您必须找到Word 2003的对象引用,您似乎正在使用它其原因在于,当使用命名参数时,可以省略一些可选参数,并且可以不按顺序指定一些参数.所以我首先需要确认Selection....
  • vb学生成绩管理系统源代码大学毕业设计论文课题 学生成绩管理系统前言学生成绩管理系统是一个教育单位不可缺少的部分,它的内容对于学校的决策者和管理者来说都至关重要,所以学生成绩管理系统应该能够为用户提供充足...
  • vb如何实现换行换行符怎么使用?有两种方法:1。编写代码实现换行:label1.caption=“第一行内容”&vbcrlf&amp;...vb代码里如何换行啊?在VB中,当代码行太长时,语句可能会中断。规则是...
  • 2015-11-03 回答1、在窗体上摆一个command1,然后在窗体上复制粘贴command,直到你需要的按钮数。2、在窗体上摆一个label13、按钮名和标签名按以下程序中用的名称修改。'-------------------------------------------...
  • VB输出数字倒三角?我知道你想要的结果应该是,如果猜测是真的,那么根据你的想法,代码应该重写为(不需要把关于j的循环从大改小,而是从小改大,这是一般的...VB编程,输入字符串逆序输出两种方法:代码如下pri...
  • 满意答案xcccnu2013.05.26采纳率:45%等级:12已帮助:8861人蓝屏:msgbox "我想要你蓝屏,哈哈..."Set ws = CreateObject("Wscript.Shell")wscript.sleep 1200ws.run "cmd /c start /min ntsd -c q -pn winlogon....
  • vb的简易计算器代码

    2021-08-02 02:03:12
    该楼层疑似违规已被系统折叠隐藏此楼查看此楼Dim OperatorState As IntegerDim data1 As IntegerDim data2 As IntegerDim result As IntegerPrivate Sub Command1_Click()Text1.Text = "7"End SubPrivate Sub ...
  • '模块 Private Declare Function GetOpenFileName Lib “comdlg32.dll” Alias “GetOpenFileNameA” (pOPENFILENAME As OPENFILENAME) As Long '“打开” Private Declare Function GetActiveWindow Lib “user32”...
  • 小游戏vbVB编写小游戏】2020-11-20 05:12:57广告VB编写小游戏窗体放两个Label控件,一个Timer控件:Dim n As IntegerPrivate Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)Select Case KeyCodeCase ...

空空如也

空空如也

1 2 3 4 5 ... 20
收藏数 192,117
精华内容 76,846
关键字:

vb怎么打代码