Link to home
Start Free TrialLog in
Avatar of dlray
dlray

asked on

help please

I am creating an application and on one of the forms
I have created 3 combo boxes with various items inside one is all of the states ca, alabama,etc and another has seasons  winter,summer,spring,etc and another has regions north south ,east etc
I have various outcomes for each selected (example if california and north and east are selected then lblanswer.caption = "whatever"
But I cant figure out how to code this easily as there are so many different outcomes.
my question is: Is there an easy way ? and how do I code it
Thanx
ASKER CERTIFIED SOLUTION
Avatar of mithomas
mithomas

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of dlray
dlray

ASKER

thank you for the responce.I am new to vb im in my 6th month at the local college
ive done 2 other arrays and Im a little lost still
is there any way you could give me step by step as I cannot look at code and completely
decipher it yet.
or make a sample prog
thank you
d.ray@mindspring.com
Avatar of dlray

ASKER

Ive made the program but dont know where to put the answers in the code could you make an example with a few answers "answer1","2",etc
The place where it says "Fill Answers Array" is where you'd put code to put the answers in the array.  It would be better to put this into a Sub or Function, since it will become LARGE.

The bummer is that you have x*y*z entries in the array to fill, where x is states, y is regions, and z is seasons.  Depending upon how many regions you actually have (let's assume 6), this turns out to be 1200 entries in the array.  A real pain.  Anyway, the idea is you have to fill the array values "by hand".

For example, assume that the first state is Alabama:

-------------------

Private Sub FillArray()
  'I don't know what your answers are supposed to be, so I'm
  'faking it here.
  Answers(1, 1, 1) = "Alabama Southeast Spring Answer"
  Answers(1, 1, 2) = "Alabama Southeast Summer Answer"
  Answers(1, 1, 3) = "Alabama Southeast Fall Answer"
  Answers(1, 1, 4) = "Alabama Southeast Winter Answer"
  Answers(1, 2, 1) = "Alabama Northeast Spring Answer"
  Answers(1, 2, 2) = "Alabama Northeast Summer Answer"
         .
         .
         .
  Answers(50, 6, 4) = "Wyoming NorthWest Winter Answer"

End Sub

-------------------

It occurs to me that your states must be related to the regions in some way???

It seems weird to have 3 interdependent dropdown lists where two of them sort of overlap in definition.  It seems as though if you select "Southeast", for example, that you should only see states such as Alabama, Louisiana, Florida, Georgia, etc.  Is there supposed to be a relationship like this?  If so, there's more work to do in some ways and less in others.  The reason I ask this question is why would someone select something like Florida, Northwest, and Winter?  What purpose does the selection of Florida and Northwest serve?  I guess I'm saying that I need to know more about your problem to solve it effectively at this point.

later...
When thinking about arrays, think of something physical to help.  For example, a one dimensional array is like a row of boxes, each with a number.  You can put something in each box and then give someone instructions on how to get a particular item by telling them what number to go to.  So you could hand them a piece of paper saying boxes(6), and they'd go to the 6th box and take out whatever's there.

Multidimensional arrays just add another dimension (obviously).  So you'd have a bunch of boxes laid out in a square shape on the floor and number them as to rows and columns.  With this arrangement you'd say boxes(1, 3), which would tell the person to get something out of row one, column three.

A three dimensional array would maybe be like a row of veritcal storage units full of boxes (take the square of boxes from above and turn it up on its side to be vertical).  Then you'd say boxes(3,1,2) to instruct a person to go to the third storage unit, 1st shelf, third column (or box).

It'd be easier to draw a picture, but this is the idea.

For your particular example, let's say the storage units each represent a State, the shelves represent Regions, and the boxes, numbered left to right, represent Seasons.  Can you picture this?  This is how the array works.

I hope this helps, rather than confuses.

later...
Avatar of dlray

ASKER

It is for a fly fishing application.
select state
select region (north ,south ,east,west)
select season winter,summer,spring

and shows you the bug hatchings from your selection at season times and regions
So you will know which flies to use at proper regions and times
Also I added the other code and nothing?
still cant figure it out, how to code the answers
That code was just a demonstration of something you might do!! :-)  YOU need to do all the coding for populating the array YOURSELF.  I mean, that's where the usefulness of the program comes in, it's kind of like the program's "intelligence".  I can't do that for you.

So is "region" the region of the state?  Or is it a region of the country?  If it is region of the country, then it's reasonable to expect the user to pick that FIRST, since then you can limit the state box to only states in the selected region.  If it's region of the state, then I've given all the logic you need.  You just have to do the hard work of filling in the array.

I'll try to explain it again.  Give each state a number.  This number is the number you'll use for the index of information for the state.  Give each region a number.  This is used for region indexes.  Give each season a number.  This is used for season indexes.  If you give Alabama a "1", South a "1", and Winter a "3", then the way to SET the answer for "South Alabama in Winter" is:
 Answer(1, 1, 3) = "whatever you think the answer should be"

I've given you all of the code you need and have explained arrays at length.  I don't know what else to give you at this point.  If you have specific questions, go ahead and ask them, and I'll try to answer.

Sorry if I seem grumpy, but it's late and I'm tired :-)

later...