Solved

Two Dimensional Array "Brain Freeze"

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

Creating Instructional Tutorials  

For Any Use & On Any Platform

Contextual Guidance at the moment of need helps your employees/users adopt software o& achieve even the most complex tasks instantly. Boost knowledge retention, software adoption & employee engagement with easy solution.

Question has a verified solution.

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

When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
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…
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…

697 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