VBGood网站全文搜索 Google

搜索VBGood全站网页(全文搜索)
首页 - 经验之谈 - 初识object-对象(object)是什么?
发表评论(0)作者:不详, 平台:VB6.0+Win98, 阅读:9469, 日期:2001-05-08
Introduction

Hi there avid programmers! It注释:s great to see you at the start of a new series of articles on objects and Visual Basic.

Well, lets start with the basics (excuse the pun): I注释:m Sam Huggill and I will be guiding you through the jungle of class modules, ActiveX components, DLLs and much more over the coming weeks. If you ever had any doubts about objects, read on!

In this first part, I will be covering the following things:

- What注释:s an object?
- Where can I pick up an object?
- Why should I use objects?
- My first object!

OK - Now that we are clear about what I注释:m supposed to be doing, we better proceed! But just before we do, I want to remind you that I want to hear what you think about this tutorial. Boring, interesting, too much or too little? Let me know by clicking on the Post Feedback Now link at the bottom of each page of this tutorial.

Right, on with the learning!

What注释:s an object?

Is it a bird? Is it a plane? No, it注释:s an object! (Sorry for those of you who never watched superman :)

Objects are things that you can program with, things that make programming easier. They contain a set of methods and properties that allow you to make the object do certain things without actually having to look at the objects code. For example, you have probably used the following statement many times:

Text1.Text = ""
Remeber that? Well, what you are doing is setting the property Text, of the text box object Text1 to equal nothing.

See, objects are really easy, you注释:ve been using them ever since that first "Hello World!" program you wrote!

In fact, all the controls you see on your VB toolbox are all objects. For a better look at objects, either press F2 or click View, Object Browser. This nifty little window allows you to see all the properties and methods of the objects currently loaded.

If you click on the combo box that currently contains , and select VB, you will see a list (on the left) of all the standard controls in your toolbox.

Just try clicking on TextBox. See, recognise some of those methods and properties? (I sure hope so :)



Here注释:s what we注释:ve done so far:

- Example of the Textbox object
- Realised how simple objects can be (yes, you have really :)
- Taken a look inside the object browser

Right, lets find out where you get other objects from >>