Visual Basic - Computer Science

posted by .

I'm trying to right a program with Multidimensional Arrays.

These are the instructions for the program:
The Valley Boulevard (VB) Auto Center management is pleased with your progress in developing their system. They require you to develop a new feature for their system.

Main Form. The main form for this project is shown below. VB Auto sells its own brand of spark plugs. In order to allow system users to cross-reference to major brands, the firm keeps a table of equivalent part numbers. You are to computerize the process of looking up part numbers in order to improve customer service.

Requirements. Name the project VBAutoLab8 + YourLastName – for example, if your last name is Bock, name the project VBAutoLab8Bock.

System Startup. The system will start up with the Their Part Number textbox blank (this currently displays RJ6) and NO Brand selected by default (none of the radio buttons are checked). Likewise, the Our VB Part Number display label (this currently displays the value PR223) for output will be blank. On startup, the cursor (focus) should be set to the textbox. The tab order should be Their Part Number textbox, Brand radio buttons, Lookup button, Clear button, then Exit button.
Lookup button – system operation. The system user will:
Enter the competitor's part number for that brand into the input textbox that is provided on the form shown above.
Select the brand by clicking one of the radio buttons.
Click the Lookup button - the system should display the equivalent VB Part Number to the output label shown above.
The lookup should work even if Their Part Number is NOT entered in capital letters.
Your code must use a search technique taught in the chapter, not simply a long series of IF statements. The program code for the lookup procedure must use a condition-controlled loop.
Display an appropriate error message such as “Reenter Their Part Number and Check Brand” if the lookup fails to find a match. Also display the OK button and Critical Error icon as part of the message box.
Clear button. When this button is clicked, clear the brand radio button selection so that none of the radio buttons are selected, clear the textbox and output display label, and set the focus back to the textbox.
Exit button. When this button is clicked, end the application.
Data Storage. Store the part numbers in a two-dimensional table (array). The data for the system may be loaded during the Form_Load event or you may wish to declare the array as a module-level array. Using the module-level array is probably easier as the approach will be similar to that used at the end of the Chapter 8 notes for the multi-dimensional array. The data for this application are given in the following table. Do not store the header row (Brand A, Brand C, etc) in the table as this is not part of the data.

I was able to create the table and set up the form part. But I can't actually figure out what code I'm suppose to use to make it execute properly. I've tried different methods and I just don't know how to call the index number and make the proper part show up in the VBAuto box!


Thank you for any and all help in advance!

  • Visual Basic - Computer Science -

    Some of the tutorials here may help you:


  • Visual Basic - Computer Science -

    "I've tried different methods and I just don't know how to call the index number and make the proper part show up in the VBAuto box!"
    If you post what you've tried, we can help you get on the right track. Without seeing your attempts, we don't know where you've got a problem.
    Alternatively, you can tell us the symptoms, and we'll help you find the right direction.

  • Visual Basic - Computer Science -

    Public Class Form1
    Public SparkPlugsString(,) As String = {{"VBAutoPart", "Brand A", "Brand C", "Brand X"},
    {"PR214", "MR43T", "RBL8", "14K22"},
    {"PR223", "R43", "RJ6", "14K24"},
    {"PR224", "R43N", "RN4", "14K30"},
    {"PR246", "R46N", "RN8", "14K32"},
    {"PR247", "R46TS", "RBL17Y", "14K33"},
    {"PR248", "R46TX", "RBL12-6", "14K35"},
    {"PR324", "S46", "J11", "14k38"},
    {"PR326", "SR46E", "XEJ8", "14K40"},
    {"PR444", "47L", "H12", "14K44"}}

    Private Property VerticalPrintLocationSingle As Object

    Public Sub LookupButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles LookupButton.Click
    Dim PartIndexInteger As Integer
    Dim BrandIndexInteger As Integer

    BrandIndexInteger = BrandBox.SelectedIndex
    PartIndexInteger = PartBox.SelectedIndex

    If PartIndexInteger <> -1 And BrandIndexInteger <> -1 Then
    VBAutoTextBox.Text =
    SparkPlugsString(PartIndexInteger, BrandIndexInteger).ToString("")
    MessageBox.Show("Select the Part and Brand.", "Information Missing", MessageBoxButtons.OK, MessageBoxIcon.Asterisk)
    End If
    End Sub
    End Class

    This is pretty much what I have.. But I just can't figure it out :-/

    I'm a pretty big beginner at this... I tried looking up tutorials (thank you very much for that by the way) and couldn't find what I was looking for...

  • Visual Basic - Computer Science -

    You have created a multi-dimensional array for the equivalent part numbers.

    You will need to search the table for the competitive part number, if there is a match, you will display your own brand's part number. That's the idea.

    In practice, you need a for loop to go through all the parts until you find the competitive part number. Then return your own brand.

    In more sophisticated systems, the search will not be a sequential search, but more like a binary search on a sorted list or index. For now, with less than 500 parts, efficiency is not a problem.

    You must have learned about sequential search and multi-dimensional arrays.

    Give it a try, and post what you have. Your current code shows the search of only one item, without searching through the who array. So perhaps you might even have syntax error.

Respond to this Question

First Name
School Subject
Your Answer

Similar Questions


    Could you please help me write a program using basic or visual basic that would prevent spam/unsolicited e-mails computers. You have to be kidding. If not, you need a reality check. Do you actually think anyone will do that for you …
  2. Visual Basic

    Notes in a program which explains what the program is doing are called ______ Comments?
  3. Business Accounting/Operations Management

    Two years have passed since the Phoenix STS program faced the loss of funding for its East Valley operations. During the two years, Phoenix STS has attempted to broaden the funding base of the entire program, but with particular emphasis …
  4. visual basic

    in visual basic, notes in a program which explain what the program is doing are called?
  5. visual basic

    notes in a program which explain what the program is doing are called......?
  6. Computer

    Write the program that will calculate and display the career statistics for a hockey player. The program must be written in Visual Basic 2008 console application.
  7. visual basic 2010

    I am totally lost with arrays. I have a program that needs to store users entries(first & last name...etc) in 2 different arrays. The summary button then loops through each array and outputs their contents to the immediate window. …
  8. Programming (Visual Basic)

    Im seem to be having trouble with this Exercise. Would you mind helping me please?
  9. visual basic programming

    Write a Visual Basic program that will calculate the assessment marks of a student taking the Computer Programming subject in College. The program must be able to determine the total result and finally display the grade of that student. …
  10. visual basic

    Write a visual basic program to calculate total pay of employee who get an additional pay of 10% to their basic salary if they worked for more than 10years for the company

More Similar Questions