VB程序中使用脚本支持
正在开发小秘书系统并不断提高其智能水平,其中用到的是脚本支持的技术
虽然这部分不属于初学者使用,然而有些人想学这个东东,这里就发~~~布出去吧!
新建一个标准exe工程(Standard EXE);
"工程"(Project)-->"部件"(Components)
选定"Microsoft Script Control 1.0" ,位置是C:\WINDOWS\system32\msscript.ocx
添加控件到工程,个人爱好我命名mscScript
然后添加一些控件,得到如下图的界面,然后是下面这些函数,过程:
Private Sub Form_Load()
mscScript.AddObject "frmMain", frmMain
mscScript.AddObject "objScript", objScript
End Sub
'---------------------------------------
'vbClass Moudle clsFunction
'---------------------------------------
Public Function strRun(ByVal str As String) As String
Dim strName As String
Dim strExpress() As String
strName = Left(str, InStr(str, " ") - 1)
strExpress = Split(Mid(str, InStr(str, " ") + 1), ",")
strRun = CStr(frmMain.mscScript.Run(strName, strExpress(0), strExpress(1)))
End Function
需要注意是类模块要生成对象:Public objScript As New clsFunction,这个知识在一般程序开发下很少接触;
然后就是vbScript(脚本)和Visual Basic的区别,前者是后者的子集,语法上不能混乱
最常见的错误是:vbscript的变量只有Variant类型,Next 后面不跟变量名等...
源代码在我的资源那里有,
http://prsniper.download.csdn.net/user/prsniper/all/1
希望更多的人学好编程,不断提高技术,深度的探讨可以加我QQ:627666017
空间只面向新手,,,
相关文档:
内容提要摘要: The software of visual basic developed by Microsoft corporation is becoming one of the main develop tools at today。 As it's remarkable peculiarity, the Grid control has very great practical and active use。 This topic discusses how to use the grid control of VB to develop prati ......
在VB中要想调用Excel,需要打开VB编程环境“工程”菜单中的“引用”项目,并选取项目中的“Microsoft Excel 11.0 object library”项。由于你的Excel版本不同,所以这个选项的版本号也是不同的。
因为EXCEL是以层次结构组织对象的,其对象模型中含有许多不同的对象元素。
&n ......
简单
在Global.asa文件中加入如下的代码:
Java代码
1. <SCRIPT LANGUAGE="VBScript" RUNAT="Server">
2.
3. Sub Application_OnStart
4.
5. '当服务器开启时,设置在线用户计数器为0
6. Application("ActiveUsers") = 0
7.
......
'引用:Microfoft VBScript Regular Expressions 5.5 '一个正则提取功能
Public Function regGetStr_three(ByVal myString As String, ByVal patReg As String) As String()
Dim objRegExp As RegExp
Dim objMatch As Match
Dim colMatches As Ma ......