Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

To Cajun Centurion; The Vampire 1

Status
Not open for further replies.

2781

Technical User
Feb 26, 2002
21
BE
Thanks for your assistance to my previous question on dynamic array whereby one dimension is an existing array

Could you explain a bit more about

- "TYPE" variable instead array

- a dictionary?
 
Vampire's suggestion to setup a type structure something like the following:

Private Type INTERVENTION
Attr0 As String
Attr1 As Long
Attr2 As Integer
Attr3 As String
Attr4 As Long
Attr5 As Long
Attr6 As Long
End Type

where Attr[0-6] refer to the current items that you have in your one dimensional array. It would be useful to give them meaningful names and types.

Then in your code

Dim Interv_Array(6) as INTERVENTION
Dim Single_Interv as INTERVENTION

Single_Interv.Attr0 = value00
Single_Interv.Attr1 = value01
...
Interv_Array(1) = Single_Interv

Single_Interv.Attr0 = Value10
Single_Interv.Attr1 = Value11
...
Interrv_Array(2) = Single_Interv

and to retrieve from the array

Single_Interv = Interv_Array(2)

and you can access the individual aspects of the intervention by structure reference for example

txtName.Text = Single_Interv.Attr0


So what you have is a 1-dimensional array where each element in the array is of type INTERVENTION. The INTERVENTION type structure contains the seven attributes of each intervension. You can then redim preserve this array at necessary.

---------

The Dictionary is an object in the Scripting Runtime Library which allows you set up name-value pairs.

Declare your main dictionary of interventions.

Dim InterventionSet as New Scripting.Dictionary

when you have a new intervention then you would do something like this:

Dim SingleInterv as New Scripting.Dictionary

SingleInterv("Attr0") = Value00
SingleInterv("Attr1") = Value01
...
The key names ("Attr0", and "Attr1") may be string variables

InterventionSet("Intervension1") = NewIntervention

and so forth

To reference individual Interventions

Set SingleInterv = InterventionSet(strIntervKey)

and can reference by

txtName.text = SingleInterv(strNameKey)


Either approach should work well for you.
Good Luck
--------------
As a circle of light increases so does the circumference of darkness around it. - Albert Einstein


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top