Results 1 to 3 of 3

Thread: need help with arrays

  1. #1

    Thread Starter
    New Member
    Join Date
    May 2006

    need help with arrays

    I'm going crazy. i can't figure out how to write a look-up code for a two dimensional arrays. Can you guys please help me. here is the more detail instruction:

    When the user selects a Brand from the list box and types a Part Number into the text box, and then clicks the “Find VB Auto Part” button, your program will search (i.e., do a “table look-up” on) the appropriate column of the two dimensional array for the Part Number. If the Part Number is found in the two-dimensional array, its corresponding VB Auto Part (located in the one-dimensional array) is retrieved and displayed in the label designed for that purpose.

    here are the values for the arrays

    VB Auto--------- Brand A-----------Brand C-----------Brand X
    PR214---------------MR43T----------- RBL8------------- 14K22
    PR223---------------R43-------------- RJ6---------------14K24

    i'd really appreciate any help. the book that i'm using is not much of help for me. thank guys
    Last edited by noobee; May 2nd, 2006 at 11:19 PM.

  2. #2
    .NUT jmcilhinney's Avatar
    Join Date
    May 2005
    Sydney, Australia

    Re: need help with arrays

    Welcome. I'm assuming that those are the more detailed instructions given to you by your teacher for your assignment. Before we tell you how to do your homework, what have you got so far?

  3. #3

    Thread Starter
    New Member
    Join Date
    May 2006

    Re: need help with arrays

    here's what i got...

    Private Sub findVBAutoPartButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles findVBAutoPartButton.Click

    Dim partNumberString(,) As String = {{"MR43T", "RBL8", "14K22"}, {"R43", "RJ6", "14K24"}, _
    {"R43N", "RN4", "14K30"}, {"R46N", "RN8", "14K32"}, {"R46TS", "RBL17Y", "14K33"}, _
    {"R46TX", "RBL12-6", "14K35"}, {"S46", "J11", "14K38"}, {"SR46E", "XEJ8", "14K40"}, _
    {"47L", "H12", "14K44"}}

    Dim vbString() As String = {"PR214", "PR223", "PR224", "PR246", "PR247", _
    "PR248", "PR324", "PR326", "PR444"}

    Dim errorFlagBoolean As Boolean
    Dim groupFoundBoolean As Boolean = False
    Dim columnInteger As Integer
    Dim rowInteger As Integer
    Dim indexInteger As Integer
    Call ValidateInput(errorFlagBoolean)
    If errorFlagBoolean = False Then
    If brandListBox.SelectedIndex <> -1 Then
    brandListBox.SelectedIndex = columnInteger
    End If
    Do Until groupFoundBoolean = True Or indexInteger > 8
    If partNumberTextBox.Text = partNumberString(rowInteger, columnInteger) Then
    vbString(indexInteger) = partNumberString(rowInteger, columnInteger)
    End If

    If groupFoundBoolean = False Then
    MessageBox.Show("Sorry, VB Auto Center Does not carry this part for this brand", _
    "Part Not Found", MessageBoxButtons.OK, MessageBoxIcon.Information)
    End If

    End If

    End Sub

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Click Here to Expand Forum to Full Width