[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

parameterized read-write property

Posted on 2005-04-25
1
Medium Priority
?
200 Views
Last Modified: 2010-04-23
I have to create a read-write property named CarrierName. This property has to accept one argument the aircraftID. Read or write theCarrierName property for the correct AircraftID. Could you please tell me if this is correct.

Public property CarrierName (ByVal AircraftID as Integer) as String
      Get
            Return CarrierName(AircraftID)
       End Get
       Set (ByVal value as string)
              CarrierName(AircraftID) = value
       End Set
End Property

I'm in a vb.net class and having problems so I can use all the help I can get.

0
Comment
Question by:augie0216
1 Comment
 
LVL 96

Accepted Solution

by:
Bob Learned earned 1500 total points
ID: 13866219
No, that would create a circular reference.  You need an internal field property to store Property Values:

Private _carrierNames As New HashTable

Public Property CarrierName (ByVal AircraftID as Integer) As String
      Get
            If _carrierNames.ContainsKey(AircraftID) Then
               Return _carrierNames(AircraftID)
            End If
       End Get
       Set (ByVal Value As String)
              _carrierNames.Add(AircraftID, Value)
       End Set
End Property

Bob
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This tutorial demonstrates one way to create an application that runs without any Forms but still has a GUI presence via an Icon in the System Tray. The magic lies in Inheriting from the ApplicationContext Class and passing that to Application.Ru…
Well, all of us have seen the multiple EXCEL.EXE's in task manager that won't die even if you call the .close, .dispose methods. Try this method to kill any excels in memory. You can copy the kill function to create a check function and replace the …
Despite its rising prevalence in the business world, "the cloud" is still misunderstood. Some companies still believe common misconceptions about lack of security in cloud solutions and many misuses of cloud storage options still occur every day. …
Is your OST file inaccessible, Need to transfer OST file from one computer to another? Want to convert OST file to PST? If the answer to any of the above question is yes, then look no further. With the help of Stellar OST to PST Converter, you can e…
Suggested Courses

829 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question