Re: Variable for a Variable



Thanks Dag.

That runs along the same lines as Steve was mentioning as well.

Looks like I need to focus on Classes a bit before I venture into this.
Never bothered to read a book on VB when I started. Just kepted hitting F1
for help or scouring the net for code tidbits to get over logic humps.
Should have studied this better. Written so many programs that could have
been done so much better. Live and learn.

Thanks for the suggestions.

:-)


"Dag Sunde" <me@xxxxxxxxxxxx> wrote in message
news:8im8f.7193$qE.1539686@xxxxxxxxxxxxxxxxxx
> "ProfitMaxTrading.com" <nospam@xxxxxxxxxx> wrote in message
> news:oMh8f.776$0M1.430@xxxxxxxxxxxxx
>> Hello Frank.
>>
>> I certainly can see the advantage to your suggestion. The reason I
>> originally went the other way (wrong way - duh beginner here) is that
>> each tool had has completely different elements that describe them.
>>
>> For example:
>>
>> The Trendline tool requires:
>>
>> Cordinates x1, x2, y1, y2.
>> Record Number (to ID price bar)
>> Time Frame (Daily, Weekly or Monthly)
>> Visible (for delete purposes)
>> Color
>> ...
>>
>>
>> Then say the FibLines tool requires:
>>
>> Record Number A (for starting price bar - x axis coordinates)
>> PriceA (for starting price bar high/low price - y axis coordinates)
>>
>> Record Number B (for ending price bar)
>> Price B
>>
>> Time Frame (D,W,M)
>> Visible
>> Color
>> Type (Retracement/Expansion/Alt-Expansion)
>>
>>
>> Can you see what I mean? Each tool has their own UNIQUE requirements to
>> locate, identify, create, etc.
>>
>> Now I could create a TOOL_STRUC that simply contained every possible tool
>> variable I'll need. But would that be a better way to go than rather
>> having these unique STRUCS due to the tools being so diverse?
>>
>> Yes, they do all have some items in common.
>>
>> Color
>> Visible
>> Time Frame
>>
>
> Then expand on Frank's idea, but drop the STRUCT.
>
> Replace it with Specialised classes for each tool, and declare your
> array of type Object.
>
> Then you can add an instance of CSaw, and anotherone of CHammer
> Since it is unique classes, they can have different methods and
> properties,
> but can be added to the same array since that is declared as Object.
>
> tools(index).numberOfTeeths
>
> Note that you must know what kind of tool hides behind what index to be
> able to access its specific properties, but you can check at runtime:
>
> If TypeOf tools(index) = "CHammer" then...
>
> You can also make a class hierachy by collecting all the common
> properties,
> and use Inheritance "by containment".
>
> --
> Dag.
>
>


.