Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Cost for .Net
Message
General information
Forum:
ASP.NET
Category:
Other
Title:
Miscellaneous
Thread ID:
00609123
Message ID:
00618049
Views:
25
Here is an example,

default public property phone(ByVal Location As String) As String
get
return colphones.item(Location)
end get
set(ByVal Value As String)
if colphones.ContainsKey(Location) Then
colphones.Item(Location) = Value
else
colphones.add(Location, Value)
end if
end set
end Property

* Normaly we will need code like this to use the phone property
Dim myperson as new Person()
MyPerson.Phone("home") = "555-1234"

*But with the property marked as Default we can use,
MyPerson("home") = "555-1234"

Carl.


>>VB.NET does support default property, see VB.NET professional Wrox book page 324
>
>Can you quote a passage out of the book? If you look at:
>
>http://www.vbpj.com/upload/free/features/vbpj/2000/12dec00/bh0012/default.asp
>
>It explains:
>
>VB6 and earlier versions allow you to write code like this, where lblTitle is a Label control:
>
>
lblTitle = "Top Ten Things"
>
>This works because the label control has a default property, which is Caption. So the preceding line really means this:
>
>
lblTitle.Caption = "Top Ten Things"
>
>VB.NET does away with the concept of default properties and methods in most circumstances. So the first form won't work in VB.NET. You must use the second form.
Carl Barbeau.
Analyst Designer office systems.
Carl Barbeau consultant Inc.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform