"Kyote" <tr******@nospamgmail.comwrote in message
news:k1********************************@4ax.com...
>
What I'm doing is adding an instance of myFiles to the sourceArray
arraylist. That way I can avoid having to redim anything and also
avoid the redimming overhead.
My program is going to parse filenames and create directories based on
certain filename templates. Then it will move the files into the
appropriate directory. The reason I'm doing it this way is because it
allows me to keep all the information together and I can then send
only specific parts to my parsing subs which will then add the missing
information to each set of variables in each object in the arraylist.
I tried to think it through and determine the best approach for doing
what I wanted this app to do but I found myself not wanting to begin
because I could think of so many different ways to approach it. So
finally I decided to just do it and make alterations as my knowledge
grew. I know that's not really a good way to go about it but this app
is just a little tool to make certain things I do for a hobby of mine
easier to do. The added benefit is that it helps me learn vb.net a
little better as well.
So, is there a way for me to get the auto complete to appear doing it
the way I am? Or should I change my class to use get and sets as you
suggested?
'Tho I haven't done (or seen) benchmarks comparing ReDim to ArrayList, I
suspect they will be about equal since both are expanding/contracting array
structures of some sort and that tends to be a memory-intensive process
(relatively speaking). Actual use of the array, I suspect, will have less
overhead than the ArrayList; I seem to recall ArrayList as being based on a
Collection and those tend to be slow, at least large Collections and in VB
classic.
Tinkering with code, especially new libraries, is a great way to pick up
skills and knowledge (IMO, of course). The "best approach" is the one that
works for you. I sometimes find myself pondering an idea for days on end
just trying to determine how I want to structure the solution. When it comes
time to write the code though it is not unusual for the whole idea to go
south and I end up falling back on old solutions. (Ah, but it is all about
the hunt. That's why they call fishing "fishing." If it were about actually
catching fish it would be called "catching.")
Some people (me) absolutely love to stumble around in the dark just for the
challenge. Others prefer the safety of a guided tour. Flailing around in
code allows you to discover alternative ways of accomplishing the task and,
in the process, generates far more intimate knowledge of the things you
touch along the way than any book or "expert" site can provide; the
knowledge sticks if you uncover it on your own and yields a certain
satisfaction once a solution is discovered. But enough of the soapbox
speech...
The only ways I know of that will give you the "auto complete" are defining
an object as a Class, a Structure (Type in VB classic), or an Enum. Since
your needs seem to indicate the "thing" requires validation routines and
other supporting code specific to this type of object, I would personally
use a Class. How that works in conjunction with ArrayList, I don't know
(yet). There is probably a slick trick, not necessarily inheritance, that
will allow you to use the Class with ArrayList yielding the best of both
worlds.
For now, the question you have to answer is which of the two - auto complete
or ArrayList - is of more value to you at the moment.