重拾VB6(11.1):VB6对象导论笔记

前端之家收集整理的这篇文章主要介绍了重拾VB6(11.1):VB6对象导论笔记前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

本文标签重拾VB6

来自MSDN-2001-OCT: Visual Tools and Languages/Visual Studio 6.0 Documentation/Visual Basic Documentation/Using Visual Basic/Programmer’s Guide/Part 1: Visual Basic Basics/Programming Fundamentals/Working with Objects

(1)For simplicity,most of the material outside of this chapter won't make many references to an object's class. Just remember that the term "list Box control," for example,means "an instance of the ListBox class."

(2)关于对象层次
在VB6中至少有两种对象层次结构你必须要熟悉:(1)来自其他应用程序组件的对象层次结构;(2)Data Access Object的层次结构。
在VB6中构成对象层次主要有两种手段:(1)Collections;(2)containers(比如窗体包含控件)。

(3)关于集合:
集合对象里包含的对象称为集合对象的成员对象
集合成员的index number从0开始编号
要访问特定的成员,用名字或者编号,如下:

Controls("List1") 
Controls!List1 
Controls(3) 

VB6里最常用到的集合对象:Forms,Controls,Printers。不过,据赵老虎说,Collection 不是一个基类或接口,它和 Forms、Printers 一样都是 IEnumVARIANT 的一个实现,看这个帖子8楼。

(4)关于容器:
You can use the Container property to change an object's container within a form.
The following controls can contain other controls: Frame control,Picture Box control,Toolbar control

(5)关于New:
Using New with the Set statement is faster and is the recommended method.
You can't use New to create:A variable of any generic object type,or of any specific control type,or of any specific control.
There are four generic object types in Visual Basic: Object,Form,Control,MDIForm. 注意,MDIForm只是为了以后的扩展,在程序中不要用它,而要用例如MDIForm1这样的具体类。

原文链接:https://www.f2er.com/vb/262314.html

猜你在找的VB相关文章