Solved

Two Dimensional Array "Brain Freeze"

Posted on 2002-04-16
3
243 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
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

863 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

21 Experts available now in Live!

Get 1:1 Help Now