ICANN认证国际域名顶级注册机构
网站建设,域名注册,空间租用,软件销售,广告设计 域名注册,空间租用, 网站建设,东莞网页设计,域名注册,网站推广,网站开发,网页设计 网站推广,,百度推广,新浪推广,雅虎推广,网易推广 标志设计,画册设计,包装设计,VI策划,企业形象顾问 连邦软件加盟店,提供销遥行,管家婆,速达,用友ERP,诺顿等软件报价及销售 建站必读 腾达网络,上网帮助中心, 腾达为东莞等地,提供网站建设,网站推广,广告设计,软件销售等优质服务!
建站必读


 
 
当前位置:首页 -> 建站必读 -> .NET技术
Chapter 3 Major VB.NET Changes(2)
Dim txtBillTo as TextBox

Dim txtShipTo as TextBox

txtShipTo =txtBillTo

The line of code txtShipTo =txtBillTo sets the Text property of txtShipTo to the

value in the Text property of txtBillTo . But what if that isn’t what you wanted?

What if, instead, you wanted to create an object reference in txtShipTo that referred

to the object txtBillTo ? You’d have to use this code:

Set txtShipTo =txtBillTo

As you can see, default properties require you to use the Set keyword to set refer-ences

from one object variable to another.

VB.NET gets around this problem by getting rid of default properties. Therefore, to

copy the Text property from txtBillTo into the Text property of txtShipTo ,you’d

have to use this code:

txtShipTo.Text =txtBillTo.Text

Setting the two variables equal to each other sets a reference from one to the other. In

other words, you can set an object reference without the Set keyword:

txtShipTo =txtBillTo ‘ Object reference in VB..NET

To be more precise, default properties without parameters are no longer supported.

Default properties that require parameters are still valid. Default properties with para-meters

are most common with collection classes, such as in ADO. In an ADO exam-ple,

if you assume that rs is an ADO Recordset, check out the following code:

rs.Fields.Item(x).Value ‘ OK,,fully qualified

rs.Fields(x).Value ‘ OK,,because Item is parameterized

rs.Fields(x)‘ Error,,because Value is not parameterized

The easy solution is to fully qualify everything. This avoids any confusion about

which properties are parameterized and which are not. However, as you know from

your VB days, the number of dots you have should be minimized. The reason is that

each dot requires an OLE lookup that slows you down. Therefore, you should code

carefully when dealing with parameters.

Subs and Functions Require Parentheses

As you saw in the last chapter when you used the MsgBox function, you must now

always use parentheses with functions, even if you are ignoring the return value. In

addition, you must use parentheses when calling subs, which you did not do in VB6.

For example, assume that you have this sub in both VB6 and VB.NET:

Sub foo(ByVal Greeting As String)

‘ implementation code here

En
 
 
本站关键词:
|网站开发|东莞域名空间|东莞广告公司|东莞广告设计|网站建设东莞|东莞网站制作|东莞网站推广|东莞国内域名注册|网页开发|域名注册|空间租用|东莞网站开发||网站开发|东莞域名空间|东莞广告公司|东莞广告设计|网站建设东莞|东莞网站制作|东莞网站推广|东莞国内域名注册|网页开发|域名注册|空间租用|东莞网站开发||网站开发|东莞域名空间|东莞广告公司|东莞广告设计|网站建设东莞|东莞网站制作|东莞网站推广|东莞国内域名注册|网页开发|域名注册|空间租用|东莞网站开发||网站开发|东莞域名空间|东莞广告公司|东莞广告设计|网站建设东莞|东莞网站制作|东莞网站推广|东莞国内域名注册|网页开发|域名注册|空间租用|东莞网站开发||网站开发|东莞域名空间|东莞广告公司|东莞广告设计|网站建设东莞|东莞网站制作|东莞网站推广|东莞国内域名注册|网页开发|域名注册|空间租用|东莞网站开发||网站开发|东莞域名空间|东莞广告公司|东莞广告设计|网站建设东莞|东莞网站制作|东莞网站推广|东莞国内域名注册|网页开发|域名注册|空间租用|东莞网站开发||网站开发|东莞域名空间|东莞广告公司|东莞广告设计|网站建设东莞|东莞网站制作|东莞网站推广|东莞国内域名注册|网页开发|域名注册|空间租用|东莞网站开发||网站开发|东莞域名空间|东莞广告公司|东莞广告设计|网站建设东莞|东莞网站制作|东莞网站推广|东莞国内域名注册|网页开发|域名注册|空间租用|东莞网站开发|
域名注册 | 虚拟主机 | 网站建设 | 网站推广 | 广告设计 | 帮助中心 | 软件中心 | 关于腾达
东莞市腾达信息工程有限公司      本站网络实名: 东莞网站建设
地址:东莞市新城市中心区第一国际B座610   邮编:523007
电话:0769-22026071 22026072 传真:0769-22026076 24小时服务热线:13712032014
© 2002~2005 腾达网络   版权所有