I would like to contact you via email and get aquainted with collections a
little.
I love vb programming, its just so hard to get the time to learn.
"Bob Bridges" wrote:
> QBasic won't help you; I used it, too, but its only relationship to Visual
> Basic is the underlying syntax. A collection, in the OO sense, is more like
> an array than anything else we've met in QBasic, the main differences being
> a) what's stored is not a value but the variable or object itself, b) each
> item in the collection can be referred to by name as well as by index number,
> and c) the items don't all have to be of the same type.
>
> I'd be happy to explain collections and fill in other gaps you're missing,
> but perhaps in the interest of time you'd prefer, meanwhile, to do this with
> arrays. I don't use arrays, much, since a more experienced VBA programmer
> turned me on to collections, but they'll work fine in this case. Put your
> count in one array and the names in the other, then:
>
> Do
> bMoreData = False
> For ie = 0 to UBound(Count)
> If Count(ie) > 0 Then
> MsgBox Name(ie)
> Count(ie) = Count(ie) - 1
> if Count(ie) > 0 then bMoreData = True
> End If
> Next eo
> Loop While bMoreData
>
> I just naturally use collections whenever I don't know ahead of time how
> many items I might have to load.
>
> As for Collections, it sounds like you could do with a quick refresher on
> the nature of objects and work up from there. If you want to, contact me via
> email and we can go into it in as much depth as you feel like.
>
> --- "KJ MAN" wrote:
> > Well, I was pretty fluent in QBASIC Years ago and I did some
> > VB scripting about 3 years ago but I have lot most of it. I will try
> > your code and then use some trial and error to see if I can get it to
> > work with the rest of my sheets. If you have any up-front suggestions
> > on how to create and maintain my list I'm all ears. I'd like to get this
> > project ready to go by Saturday and I sill must restructure the a 6000
> > strong file/folder database.
> >
> > --- "Bob Bridges" wrote:
> > > I'm guessing that when you type "que" and "cue" you're looking for "queue",
> > > meaning a line of people waiting to get into a theater or a stack of items
> > > waiting to be processed. Seems to me the trick here is to store each name
> > > and entry count in a collection. Then start looping through the collection,
> > > checking the entry count and, if it's >0, listing the name and decrementing
> > > the count, until every item in empty. Like this:
> > >
> > > Do
> > > bMoreData = False
> > > For Each eo In Entries
> > > If eo.Count > 0 Then
> > > MsgBox eo.Name
> > > eo.Count = eo.Count - 1
> > > if eo.Count > 0 then bMoreData = True
> > > End If
> > > Next eo
> > > Loop While bMoreData
> > >
> > > At the beginning of the loop you assume this is the last time through the
> > > loop (bMoreData = False). Then you go through each item in the Entries
> > > collection, which has a name (Kelly, Pat etc) and a count (however many
> > > entries they created). If the count is still >0, my code above just MsgBoxed
> > > the name, but you'll insert code there to create a new item in your list,
> > > consisting of the person's name, and then you decrement that person's entry
> > > count. If his entry count isn't 0 yet, you're going to do another loop, so
> > > turn on bMoreData too.
> > >
> > > As long as every person has more entries to do, their names are listed in
> > > order. As soon as one's count has been reduced to 0, that person will no
> > > longer continue being listed -- but the loop will continue, the others being
> > > listed, until each one has been "listed out".
> > >
> > > I didn't get into details you may already understand, like how to create a
> > > collection and how to create an entry in your list. But if you need help on
> > > some other aspect, don't hesitate to ask.
> > >
> > > --- "KJ MAN" wrote:
> > > > I need my program to create a revolving cue from entries made by
> > > > individuals.
> > > >
> > > > If sally enters 3, george enters 2, pat enters 1 and kelly enters 5 then it
> > > > should list the entries as so:
> > > > 1.)Sally 7.)Kelly
> > > > 2.)George 8.)Sally
> > > > 3.)Pat 9.)Kelly
> > > > 4.)Kelly 10.)Kelly
> > > > 5.)Sally 11.)Kelly
> > > > 6.)George
> > > > If on the 3rd kelly entry (number 9) Don makes 2 entries then from line 10
> > > > the script would be
> > > >
> > > > 10.)Don
> > > > 11.)Kelly
> > > > 12.)Don
> > > > 13.)Kelly
|