Solved

Two Dimensional Array "Brain Freeze"

Posted on 2002-04-16
3
242 Views
Last Modified: 2010-05-02
VB EE,
I am new to VB and I need to make a two dimensional array that will have a search feature (Do until Boolean found). I am having trouble with the initial layout.

I have three Brands with product numbers. I have a fourth brand that the numbers correspond to.

I need to be able to select one of the three brands (list box?) and then input a product number (text box). The label caption will then display the corresponding result from the fourth brand.

I just need a hand getting started as my brain is locking up when I try to get this going.

I have started with:

mstrParts(0 To 8, 0 To 3) As String (It needs to be string as the product numbers are alphanumeric)


formload
mstrParts(0, 0) = "A12"
mstrParts(1, 0) = "C41"
mstrParts(2, 0) = "D22"
etc..

After I have all arrays defined, I can't seem to figure out how to get the ball rolling.

Any help would be appreciated.
Thanks.
dresdena1

0
Comment
Question by:dresdena1
3 Comments
 
LVL 100

Accepted Solution

by:
mlmcc earned 100 total points
Comment Utility
I don't really understand your data.

You select the brand then enter a part number.  Do you want to search the entire array for the part number or only one column?

Does your data look like this?

Brand1     Brand2     Brand3   Brand4
A123       B123       C123     D123
A234       B345       C124     D321
.
.
.

If so then you need to use a list box or radio buttons to select the brand.  The brand then must be translated into a column number (0-2)

row=0
notfound = FALSE
while (row < numberofrows AND PartNotFound)
  if (mstrparts(row, col) = EnteredPartNumber) then
     PartisFound
  else
     Increment row
  endif
wend

if PartIsFound then
  Display mstrparts(row,3)
else
  display "Not such part"
endif

Code is rough but this sounds like a homework problem.  The above algorithm should work.

Try to implement it.  If you have further questions feel free to post the code you have and then ask for more help.

mlmcc
0
 
LVL 5

Expert Comment

by:kcm76
Comment Utility
I dont understand what u exactly want from us?
0
 

Author Comment

by:dresdena1
Comment Utility
Homework assignment it is.
I am not looking exactly for the answer. Just a little help getting started. That is why I was somewhat vague.

I am trying to learn this, not just complete an assignment.
I think that I will be able to get through this, based on what you have shown me.

I am not going to post more code, because if I can't get it right, I will get help in class.

Thanks for your help.
dresdena1
0

Featured Post

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now