精华内容
下载资源
问答
  • VB程序托盘控件 源码实例,VB自定义一个添加程序到Windows托盘图标的控件,编译控件源码后生成Tray.ocx,源码包中附有一个调用本托盘程序的示例,在TrayDEMO文件夹内,在Class1.cls文件中实现了托盘的主要操作:将...
  • VB程序设计及应用

    2012-11-26 14:07:12
    中文名: VB程序设计及应用 作者: 李淑华图书分类: 软件 资源格式: PDF 版本: 文字版 出版社: 高等教育出版社书号: 7-04-014767-X发行时间: 2004年04月 地区: 大陆 语言: 简体中文 简介: 内容简介: 本书是新...
  • VB程序语言3

    2016-04-14 16:46:36
    Option Explicit Dim i As Integer, sum As Integer Private Sub Command1_Click() Cls Font.Size = 70 Static i As Integer i = i + 1 Print i End Sub
    Option Explicit
    Dim i As Integer, sum As Integer
    Private Sub Command1_Click()
    Cls
    Font.Size = 70
    Static i As Integer
    i = i + 1
    Print i

    End Sub
















    展开全文
  • VB程序语言1

    2016-04-14 16:24:52
    Private Sub Command1_Click() Cls Font.Size = 70 Dim arr(5) As Integer For i = 1 To 5 arr(i) = i Next For Each t In arr Print t Next End Sub
    Private Sub Command1_Click()
    Cls
    Font.Size = 70
    Dim arr(5) As Integer
    For i = 1 To 5
    arr(i) = i
    Next
    For Each t In arr
    Print t
    Next
    End Sub

    展开全文
  • Dim a As Integer Private Sub Command1_Click() Timer1.Enabled = True...Cls Timer1.Enabled = False End Sub Private Sub Timer1_Timer() Line (1000, 1000)-(2500, 2500), QBColor(Int(Rnd * 16)), BF End Sub
  • 点击此处下载Cls_Ini.cls...主要源程序: VERSION 1.0 CLASS BEGIN MultiUse = -1 'True Persistable = 0 'NotPersistable DataBindingBehavior = 0 'vbNone DataSourceBehavior = 0 'vbNone MTSTransactionMod

    点击此处下载Cls_Ini.cls

    主要源程序:

    VERSION 1.0 CLASS
    BEGIN
      MultiUse = -1  'True
      Persistable = 0  'NotPersistable
      DataBindingBehavior = 0  'vbNone
      DataSourceBehavior  = 0  'vbNone
      MTSTransactionMode  = 0  'NotAnMTSObject
    END
    Attribute VB_Name = "Cls_Ini"
    Attribute VB_GlobalNameSpace = False
    Attribute VB_Creatable = True
    Attribute VB_PredeclaredId = False
    Attribute VB_Exposed = False
    'EXAMPLE
    'ini.Path = "LampKensaki.ini"
    'ini.Read
    'strT10ComPortNo = ini.GetValue("T-10_COM_NO", "T-10_Com_No")    'T-10_Com_No=6
    'intT10WaitTime = ini.GetValue("T-10_WAIT_TIME", "T10WaitTime")  'T10WaitTime=3000
    'intShoudoSokuteiTimming = ini.GetValue("SHOUDO_SOKUTEI_TIMMING", "ShoudoSokuteiTimming")    'ShoudoSokuteiTimming=15
    'Ad_Ch = ini.GetValue("AD_CH", "Ad_Ch")
    
    
    'all the functions and variables in this file are used to operate(read/write) the .ini file
    Option Explicit
    Option Compare Binary
    
    Private Const SP As String = "["
    Private Const EP As String = "]"
    Private Const CP As String = "="
    Private Const CB As String = ";"
    
    Private Type INISection
        Name    As String
        Keys()  As String
        KeysCnt As Long
    End Type
    
    
    
    Private INI_Path    As String
    Private INI_Mode    As Boolean
    
    Private INI_SectCnt As Long
    
    Private INI_Sect()  As INISection
    Private INI_File()  As String
    
    
    
    Private Function CheckSect(ByVal Sect As String) As Boolean
    If Left$(Sect, 1) = SP And Right$(Sect, 1) = EP Then
        CheckSect = 1
    End If
    End Function
    
    Private Function CheckKey(ByVal Key As String) As Boolean
    If Left$(Key, 1) <> CB Then
        If InStr(Key, CP) Then
            CheckKey = 1
        End If
    End If
    End Function
    
    Private Function GetSectName(ByVal Sect As String) As String
    GetSectName = Mid$(Sect, 2, Len(Sect) - 2)
    End Function
    
    Private Function GetKeyName(ByVal Key As String) As String
    Dim i As Long
    
    i = InStr(Key, CP)
    If i > 0 Then
        GetKeyName = Left$(Key, i - 1)
    End If
    End Function
    
    Private Function GetValueName(ByVal Key As String) As String
    Dim i As Long
    
    i = InStr(Key, CP)
    If i > 0 Then
        GetValueName = Right$(Key, Len(Key) - i)
    End If
    End Function
    
    Private Function ChangeSect(ByVal Sect As String) As String
    ChangeSect = SP & Sect & EP
    End Function
    
    Private Function ChangeKey(ByVal Key As String, ByVal Value As String) As String
    ChangeKey = Key & CP & Value
    End Function
    
    Private Sub StrectToAry()
    Dim File() As String
    Dim i As Long, t As Long, w As Long
    Dim s As Long
    Const Dumy As String = SP & "Dummy" & EP
    
    On Error Resume Next
    
    If INI_SectCnt <= 0 Then
        ReDim INI_File(0) As String
        Exit Sub
    End If
    
    If INI_File(0) = "" Then
        If Err.Number Then
            ReDim INI_File(0) As String
            INI_File(0) = Dumy
    '       Err.Clear
        End If
    End If
    
    Do
        If s >= INI_SectCnt Then Exit Do
        If CheckSect(INI_File(w)) Or w > UBound(INI_File) Then
            ReDim Preserve File(i) As String
            If s > 0 Then
                If File(i - 1) <> "" Then
                    File(i) = ""
                    i = i + 1
                    ReDim Preserve File(i) As String
                End If
            End If
            File(i) = INI_Sect(s).Name
            For t = 0 To INI_Sect(s).KeysCnt - 1
                i = i + 1
                ReDim Preserve File(i) As String
                File(i) = INI_Sect(s).Keys(t)
            Next
            s = s + 1
            i = i + 1
        ElseIf Not CheckKey(INI_File(w)) Then
            ReDim Preserve File(i) As String
            File(i) = INI_File(w)
            i = i + 1
        End If
        w = w + 1
    Loop
    
    ReDim INI_File(i - 1) As String
    INI_File = File
    
    Err.Clear
    End Sub
    
    
    
    Public Property Get Path() As String
    Path = INI_Path
    End Property
    
    Public Property Let Path(ByVal nv As String)
    INI_Path = nv
    End Property
    
    Public Property Get Mode() As Boolean
    Mode = INI_Mode
    End Property
    
    Public Property Let Mode(ByVal nv As Boolean)
    INI_Mode = nv
    End Property
    
    Public Property Get SectCount() As Long
    SectCount = INI_SectCnt
    End Property
    
    Public Property Get KeyCount(Optional ByVal SectionNo As Long = -1, _
                                 Optional ByVal SectionName As String) As Long
    Dim i As Long
    
    If INI_SectCnt <= SectionNo Then Exit Property
    If INI_SectCnt < 1 Then Exit Property
    
    If SectionNo >= 0 Then
        KeyCount = INI_Sect(SectionNo).KeysCnt
    ElseIf SectionName <> "" Then
        For i = 0 To (INI_SectCnt - 1)
            If GetSectName(INI_Sect(i).Name) = SectionName Then
                KeyCount = INI_Sect(i).KeysCnt
                Exit For
            End If
        Next
    Else
        For i = 0 To (INI_SectCnt - 1)
            KeyCount = KeyCount + INI_Sect(i).KeysCnt
        Next
    End If
    
    End Property
    
    Public Property Get GetSect(ByVal SectionNo As Long) As String
    
    If SectionNo < 0 Then Exit Property
    If INI_SectCnt > SectionNo Then
        GetSect = GetSectName(INI_Sect(SectionNo).Name)
    End If
    
    End Property
    
    Public Property Get GetKey(ByVal SectionName As String, ByVal KeyNo As Long) As String
    Dim i As Long
    
    If INI_SectCnt < 1 Then Exit Property
    If KeyNo < 0 Then Exit Property
    
    For i = 0 To (INI_SectCnt - 1)
        With INI_Sect(i)
            If GetSectName(.Name) = SectionName Then
                If .KeysCnt > KeyNo Then
                    GetKey = GetKeyName(.Keys(KeyNo))
                End If
                Exit For
            End If
        End With
    Next
    
    End Property
    
    Public Property Get GetValue(ByVal SectionName As String, ByVal KeyName As String, _
                                 Optional ByVal Default As String = "") As String
    Dim i As Long, t As Long
    
    GetValue = Default
    
    If INI_SectCnt < 1 Then
        Exit Property
    End If
    
    For i = 0 To (INI_SectCnt - 1)
        With INI_Sect(i)
            If GetSectName(.Name) = SectionName Then
                For t = 0 To (.KeysCnt - 1)
                    If GetKeyName(.Keys(t)) = KeyName Then
                        GetValue = GetValueName(.Keys(t))
                        Exit Property
                    End If
                Next
            End If
        End With
    Next
    
    End Property
    
    Public Function SetValue(ByVal SectionName As String, ByVal KeyName As String, _
                                                          ByVal Value As String) As Boolean
    Dim File() As String
    Dim i As Long, t As Long, w As Long, z As Long
    
    
    If INI_Path = "" Then Exit Function
    
    If INI_SectCnt > 0 Then
        For i = 0 To (INI_SectCnt - 1)
            If GetSectName(INI_Sect(i).Name) = SectionName Then
                If INI_Sect(i).KeysCnt > 0 Then
                    For t = 0 To (INI_Sect(i).KeysCnt - 1)
                        If GetKeyName(INI_Sect(i).Keys(t)) = KeyName Then
                            INI_Sect(i).Keys(t) = ChangeKey(KeyName, Value)
                            Exit For
                        End If
                    Next
                    If INI_Sect(i).KeysCnt < 1 Or t > (INI_Sect(i).KeysCnt - 1) Then
                        With INI_Sect(i)
                            ReDim Preserve .Keys(t) As String
                            .Keys(t) = ChangeKey(KeyName, Value)
                            .KeysCnt = .KeysCnt + 1
                        End With
                    End If
                    SetValue = 1
                    Exit For
                End If
            End If
        Next
    End If
    
    If INI_SectCnt < 1 Or i > (INI_SectCnt - 1) Then
        If INI_SectCnt < 1 Then i = 0
        ReDim Preserve INI_Sect(i) As INISection
        With INI_Sect(i)
            ReDim .Keys(0) As String
            .Name = ChangeSect(SectionName)
            .Keys(0) = ChangeKey(KeyName, Value)
            .KeysCnt = 1
        End With
        INI_SectCnt = INI_SectCnt + 1
        SetValue = 1
    End If
    
    
    If INI_Mode Then
        SetValue = Save
    End If
    
    End Function
    
    Public Function Delete(ByVal Section As String, Optional ByVal Key As String) As Boolean
    Dim iniSect() As INISection
    Dim iniKey()  As String
    Dim i As Long, t As Long, w As Long
    
    If INI_SectCnt <= 0 Then
        Exit Function
    End If
    
    If Key = "" Then
        For t = 0 To INI_SectCnt - 1
            If GetSectName(INI_Sect(t).Name) <> Section Then
                ReDim Preserve iniSect(w) As INISection
                iniSect(w) = INI_Sect(t)
                w = w + 1
            End If
        Next
        If w < t Then
            ReDim INI_Sect(w - 1) As INISection
            INI_Sect = iniSect
            INI_SectCnt = w
            Delete = 1
        End If
    Else
        For i = 0 To INI_SectCnt - 1
            If GetSectName(INI_Sect(i).Name) = Section Then
                If INI_Sect(i).KeysCnt <= 0 Then
                    Exit For
                End If
                For t = 0 To INI_Sect(i).KeysCnt - 1
                    If GetKeyName(INI_Sect(i).Keys(t)) <> Key Then
                        ReDim Preserve iniKey(t) As String
                        iniKey(w) = INI_Sect(i).Keys(t)
                        w = w + 1
                    End If
                Next
                If w < t Then
                    ReDim INI_Sect(i).Keys(t - 1) As String
                    INI_Sect(i).Keys = iniKey
                    INI_Sect(i).KeysCnt = w
                    Delete = 1
                End If
            End If
        Next
    End If
    
    If INI_Mode Then
        Delete = Save
    End If
    End Function
    
    Public Function Read() As Boolean
    Dim rl   As String
    Dim NO   As Integer
    Dim i As Long, t As Long, w As Long
    
    On Error Resume Next
    
    NO = FreeFile()
    Open INI_Path For Input As #NO
        If Err.Number Or LOF(NO) = 0 Then
            Close #NO
            Exit Function
        End If
        Do While Not EOF(NO)
            ReDim Preserve INI_File(i) As String
            Line Input #NO, INI_File(i)
            i = i + 1
        Loop
    Close #NO
    
    INI_SectCnt = -1
    For t = LBound(INI_File) To UBound(INI_File)
        If CheckSect(INI_File(t)) Then
            w = 0
            INI_SectCnt = INI_SectCnt + 1
            ReDim Preserve INI_Sect(INI_SectCnt) As INISection
            INI_Sect(INI_SectCnt).Name = INI_File(t)
        ElseIf CheckKey(INI_File(t)) Then
            ReDim Preserve INI_Sect(INI_SectCnt).Keys(w) As String
            INI_Sect(INI_SectCnt).Keys(w) = INI_File(t)
            INI_Sect(INI_SectCnt).KeysCnt = INI_Sect(INI_SectCnt).KeysCnt + 1
            w = w + 1
        End If
    Next
    
    INI_SectCnt = INI_SectCnt + 1
    Read = 1
    End Function
    
    Public Function Save() As Boolean
    Dim NO As Integer
    Dim i  As Long
    
    On Error Resume Next
    
    Call StrectToAry
    
    NO = FreeFile()
    Open INI_Path For Output As #NO
        If Err.Number Then
            Close #NO
            Exit Function
        End If
        For i = LBound(INI_File) To UBound(INI_File)
            If Err.Number Then
                Exit For
            End If
            Print #NO, INI_File(i)
        Next
    Close #NO
    
    Save = 1
    End Function
    
    Public Sub Release()
    
    INI_Path = ""
    INI_Mode = 0
    
    INI_SectCnt = 0
    
    Erase INI_File
    Erase INI_Sect
    
    End Sub
    

    【更多阅读】

    1. [原]WMICodeCreator:C#产生WMI代码的工具
    2. [原]Cls_Ini.cls:VB写的操作ini配置文件的类
    3. [原]GetIcons:C#提取应用程序的图标资源
    4. [原]Baidu:C#利用百度来搜索网页、图片、视频等等
    5. [原]ManageStartUpApps:C#操作注册表来读取和修改开机启动项
    6. [原]Baidu:C#利用百度来搜索网页、图片、视频等等
    7. [译]用C#检测你的打印机是否连接
    8. [原]WMICodeCreator:C#产生WMI代码的工具
    9. [原]使用Excel的VBA来读取和修改bmp位图像素数据
    10. [原]DownloadWebImages:下载某页面上的所有图片

    展开全文
  • VB程序,关注我有更多的有趣的VB程序1、打印圣诞树今天使用了子过程实现打印,窗体启动就打印需要设置AutoRedraw=True界面:代码:Private Sub Form_Load() Dim i% Cls For i = 3 To 7 Step 2 Call DrawC(i, "▲...

    VB小程序,关注我有更多的有趣的VB小程序

    1、打印圣诞树

    今天使用了子过程实现打印,窗体启动就打印需要设置AutoRedraw=True

    界面:

    4a0c8ef20bad87a50be3c5af5c2260e4.png

    代码:

    Private Sub Form_Load()

    Dim i%

    Cls

    For i = 3 To 7 Step 2

    Call DrawC(i, "▲")

    Next i

    For i = 1 To 5 '打印树杆

    Print Tab(17); "▲▲"

    Next i

    End Sub

    Sub DrawC(ByVal n%, ByVal c$) '定义子过程

    Dim i%

    For i = 1 To n

    Print Tab(20 - 2 * i); String(2 * i - 1, c)

    Next i

    End Sub

    2、打印金字塔

    这个是练习For循环怎么使用

    界面:

    01d9ee2efe194a8e3a3585a07cc5587e.png

    代码:

    Private Sub Command1_Click()

    Dim n As Integer, i As Integer, j As Integer, s As String

    n = Text1.Text

    For i = 1 To n

    s = ""

    For j = 1 To n - i

    s = s + " " '""表示一个空格

    Next j

    For j = 1 To 2 * i - 1

    s = s + "*"

    Next j

    List1.AddItem s

    Next i

    End Sub

    想得到更多的VB小程序,请关注我,点击下方的广告可以更好的支持和鼓励我哦!

    展开全文
  • 第三章 VB的程序设计基础 ... VB的语言基础是BASIC语言,VB程序的语言元素主要由:  关键字(如: Dim、Print、Cls)  函数(如:Sin()、Cos()Sqr())  表达式(如:Abs(-23.5)+45...
  • 应用VB语言程序生成十个随机数

    千次阅读 2016-04-14 16:15:56
    1.在窗体的适当位置创建一个commandbutton,并在其属性窗口中将caption改为“生成数”。 2.在窗体中双击“生成数”,并在弹...Cls Dim n As Integer Dim wzs(10) As Integer n = 1 While n wzs(n) = Int(Rnd * 1
  • Private Sub Command1_Click() Cls Dim n%, i%, j% n = Val(Text1.Text) For i = 1 To n For j = 1 To n
  • FTP模块.cls 4,601 1,232 Visual Basi Open_File.bas 12,673 2,911 Visual Bas PE导出输入表演示(读文件版).bas 18,081 3,311 Visual Bas PE导出输入表演示(文件影射版).bas 15,524 2,990 Visual Bas TreeView...
  • 心脏线程序(VB6.0代码编写) \'注释:画抛物线 \'清除picture1内的图形 Picture1.Cls \'Scale方法设定用户坐标系,坐标原点在Picture1中心 Picture1.ScaleMode = 0 Picture1.ScaleMode = 3...
  • 心脏线程序(VB6.0源代码编写) '注释:画抛物线 '清除picture1内的图形 Picture1.Cls 'Scale方法设定用户坐标系,坐标原点在Picture1中心 Picture1.ScaleMode = 0 Picture1.ScaleMode = 3 Picture1.Scale (-20,...
  • 1 打开桌面上的vb软件。 2 在窗口中建立一个commandbutton,双击此窗口,在弹出的窗口中输入以下内容: 1 Private Sub Command1_Click() Cls Dim n As Integer Dim s As Integer Dim a(10) As Integer n =...
  • VB程序题:随机产生20个学生的成绩,统计各分段人数。即0-59、60-69、70-79、80-89、90-100,并显示结果。产生的数据在Picture1显示,统计结果在Picture2显示。龚沛曾解题,如下面的效果图所示,画2个图片框,画2个...
  • '描 述:一个操作windows窗口的类,含很多常用操作方法(clsWindow.cls) '使用范例:Dim window As New clsWindow ' window.getWindowHwndByTitle "计算器"'其他还有很多函数 ' window.closeWindow
  • '描 述:一个操作windows窗口的类,含很多常用操作方法(clsWindow.cls) '使用范例:Dim window As New clsWindow ' window.getWindowHwndByTitle "计算器"'其他还有很多函数 ' window.closeWindow '编 程:sysdzw ...
  • CLS的个人理解

    2018-12-19 19:49:29
    .net平台上有很多编程语言,如C#,VB等,而.net平台上的语言是有跨语言性的,就是在一种语言上写一个程序,在另一个语言上仍然能运行,但是不同语言会有不同的特性,为了规范写法,于是有了CLS(公共语言规范),是...
  • 要用VB做多媒体程序的同志必看...

    千次阅读 2001-02-27 12:06:00
    “如何同时播放两个Wav文件”的问题,其实用一个类模块就一切搞定,不需要什么控件之类的东西下面这个类模块(不知从哪里找来的,好象就是CSDN),我研究后将它修改得更好用了将下面这个类模块存为Mmedia.cls-...
  • 【05】CTS、CLS、CLR

    2019-09-30 06:53:12
    1.缩写的全称:CTS是通用类型系统(Common Type System)CLR是公共语言运行时(Common language runtime)CLS是公共语言定义(Common Language Specification) 2..Net平台下不只有C#语言,还有VB.Net、F#等语言。IL是...
  • VB之15个数字的排序

    2016-03-26 15:01:20
    打开VB程序,在窗体上新建commandbutton图标,在右侧按钮属性栏中,将“caption”改为“排序”,将“name”改为“cmdSort” step2.双击按钮图标,编写程序,程序如下: Private Sub cmdSort_Click() Cls Me.Font...
  • 第五篇 .NET高级技术之CTS、CLS、CLR CTS、CLS、CLR ...1、.Net平台下不只有C#语言,...IL是程序最终编译的可以执行的二进制代码(托管代码),不同的语言最终都编译成标准的IL(中间语言,MSIL);这样C#...
  • VB6使用API下载文件

    千次阅读 2008-03-25 15:20:00
    程序用户界面如下 本程序包括两个文件 frmDownLoad.frm (主窗体)和clsCount.cls(计算下载速度的类模块) 大家建立一个简单的VB应用程序项目,将两个文件加入项目即可 我觉得clsCount.cls有问题,望有心人查查 ######...
  • VB基础1

    2011-02-21 23:39:00
    一.VB对象的概念,事件的概念,方法的概念   1,对象     2,事件 --键盘,鼠标,程序事件     3,方法   二.模块   --窗体模块(....
  • VB编程:for循环输出杨辉三角-45

    千次阅读 2016-12-25 17:15:30
    运行效果: 程序代码: Private Sub Command1_Click()  Dim a()  n = 10    'Val(Text1.Text)  Me.Cls  ReDim a(n + 1, n + 1)  For i = 1 To n    For j = 0 To i    a(1...
  • VB生成PDF文档的例子,使用VB专用的PDF控件来实现,PDFPrinter.cls为控件代码,不使用其它额外的控件创建一个PDF文件,可自定义PDF字体,将字体存入FONT目录,然后在代码中设定。另外本程序生成的PDF文档是标准格式...
  • vb 编 码 规 则 》

    2010-02-08 16:09:46
    VB的语言基础是BASIC语言,VB程序的语言元素主要由:  关键字(如: Dim、Print、Cls)  函数(如:Sin()、Cos()Sqr())  表达式(如:Abs(-23.5)+45*20/3 )  语句(如:X=X+5 、 IF……ELSE……END IF...
  • VB中的二维鞍点

    2016-06-02 18:10:06
    今天学习了用vb程序输出一个二维鞍点,程序如下: Option Base 1 Dim anma() As Integer Dim m As Byte, n As Byte Private Sub Command1_Click()  Cls  Me.Font.Size = 30  m = 5: n = 6  ReDim anma...
  • 此为使用此控件的例子源码,整体的效果很漂亮,增加了渐变的背景色,滚动条还有立体效果,看上去有点个性了,而且也可以和你的应用程序窗口风格融合在一起,附带的CTL和cls控件源码也可帮助你进一步学习VB的相关技巧...
  • .net学习之CTS、CLS和CLR

    2015-01-27 12:12:00
    CLR:公共语言运行时,就是所有.net语言写的程序的公共运行时环境,比如C#、VB.Net等语言写的程序需要运行在CLR上,然后CLR解析执行操作系统的相关指令,CLR是.net程序运行在操作系统的必备环境。  就像JAVA程序...

空空如也

空空如也

1 2 3 4 5 6
收藏数 105
精华内容 42
关键字:

vb程序cls