?? vbs600.htm
字號(hào):
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"><HTML>
<HEAD><TITLE>Set Statement</TITLE>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso8859-1">
<META NAME="MS.LOCALE" CONTENT="EN-US">
<META NAME="PRODUCT" CONTENT="Visual Basic Scripting Edition">
<META NAME="TECHNOLOGY" CONTENT="SCRIPTING">
<META NAME="CATEGORY" CONTENT="Language Reference">
<META NAME="Keywords" CONTENT="New,Set statement,Nothing,object references,references object,variables assigning,assignment statements,references,variables"><META NAME="Description" CONTENT="Set Statement"></HEAD>
<BODY BGCOLOR=FFFFFF LINK=#0033CC>
<!--TOOLBAR_START-->
<!--TOOLBAR_EXEMPT-->
<!--TOOLBAR_END-->
<FONT FACE="Verdana, Arial, Helvetica" SIZE=2>
<TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0 WIDTH=100%><TR VALIGN=TOP><TD WIDTH=360>
<FONT SIZE=1 COLOR=#660033>Microsoft® Visual Basic® Scripting Edition</FONT><BR>
<FONT SIZE=5 COLOR=#660033><B>Set Statement</B></FONT>
</TD>
<TD ALIGN=RIGHT>
<FONT SIZE=2> <A HREF="vbstoc.htm">Language Reference</A> <BR>
<A HREF="vbs16.htm">Version 1</A> <P></FONT>
</TD></TR>
</TABLE>
<FONT SIZE=2><p>
<A HREF="vbs601.htm">See Also</A></FONT>
<HR noshade SIZE=1>
<H5>Description</H5>
<BLOCKQUOTE>Assigns an object reference to a variable or
<A HREF="vbs0.htm#defProperty">property</A>.</BLOCKQUOTE>
<H5>Syntax</H5>
<BLOCKQUOTE><b>Set</b> <i>objectvar </i><b>=</b> {<i>objectexpression</i> | <b>Nothing</b>}
<P>
The <b>Set</b> statement syntax has these parts:<P>
<TABLE WIDTH=87% BORDER=1 CELLPADDING=5 CELLSPACING=0>
<TR VALIGN=TOP BGCOLOR="#DDDDDD">
<TD><FONT SIZE=2><b>Part</b></FONT></TD>
<TD><FONT SIZE=2><b>Description</b></FONT></TD></TR>
<TR VALIGN=TOP>
<TD><FONT SIZE=2><i>objectvar</i></FONT></TD>
<TD><FONT SIZE=2>Name of the variable or property; follows standard <A HREF="vbs0.htm#defVariable">variable</A> naming conventions.</FONT></TD></TR>
<TR VALIGN=TOP>
<TD><FONT SIZE=2><i>objectexpression</i></FONT></TD>
<TD><FONT SIZE=2>Expression consisting of the name of an object, another declared variable of the same <A HREF="vbs0.htm#defObjectType">object type</A>, or a function or method that returns an object of the same object type.</FONT></TD></TR>
<TR VALIGN=TOP>
<TD><FONT SIZE=2><b>Nothing</b></FONT></TD>
<TD><FONT SIZE=2>Discontinues association of <i>objectvar</i> with any specific object. Assigning <i>objectvar</i> to <b>Nothing</b> releases all the system and memory resources associated with the previously referenced object when no other variable refers to it.</FONT></TD></TR>
</TABLE></BLOCKQUOTE>
<H5>Remarks</H5>
<BLOCKQUOTE>To be valid, <i>objectvar</i> must be an object type consistent with the object being assigned to it.<P>
The <b>Dim</b>, <b>Private</b>, <b>Public</b>, or <b>ReDim</b> statements only declare a variable that refers to an object. No actual object is referred to until you use the <b>Set</b> statement to assign a specific object.<P>
Generally, when you use <b>Set</b> to assign an object reference to a variable, no copy of the object is created for that variable. Instead, a reference to the object is created. More than one object variable can refer to the same object. Because these variables are references to (rather than copies of) the object, any change in the object is reflected in all variables that refer to it.</BLOCKQUOTE>
<hr noshade size=1>
<p align=center><em><a href="../../common/colegal.htm">© 1997 by Microsoft Corporation. All rights reserved.</a></em></p>
</FONT></BODY></HTML>
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -