Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Two Dimensional Array "Brain Freeze"

Posted on 2002-04-16
3
Medium Priority
?
252 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 101

Accepted Solution

by:
mlmcc earned 400 total points
ID: 6945738
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
ID: 6945747
I dont understand what u exactly want from us?
0
 

Author Comment

by:dresdena1
ID: 6945773
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

[Webinar] Lessons on Recovering from Petya

Skyport is working hard to help customers recover from recent attacks, like the Petya worm. This work has brought to light some important lessons. New malware attacks like this can take down your entire environment. Learn from others mistakes on how to prevent Petya like worms.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

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…
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
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…
Suggested Courses

618 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