I can not tell if my array is not working at all. Any help appreciated would be great! Here is the code:

Friend Class pizzaarray
    Structure Size
        Dim sizedecimal As Decimal
        Dim crustdecimal As Decimal
    End Structure
    'Hold group number and total for 8 groups
    Private pizzaarray(7) As Array
End Class
'Lookup the pizza size and style for price
        Dim rowdecimal, columndecimal As Decimal
        Dim indexinteger As Integer = 0
        Dim pizzafoundboolean As Boolean
        Dim stylefoundboolean As Boolean
        Dim pizzadecimal As Decimal
        Dim pizzaarray As Decimal
        Dim pizzasize As Decimal
        Dim pizzastring As Decimal
        Dim stylestring As Decimal
        Dim styledecimal As Decimal

        With Me
            Try

                .sizeComboBox.SelectedText = Decimal.Parse(Me.sizeComboBox.SelectedText)
                Do Until pizzafoundboolean Or indexinteger > 3
                    If indexinteger = .sizeComboBox.SelectedIndex Then
                        pizzastring = indexinteger
                        pizzafoundboolean = True
                    Else
                        indexinteger += 1
                    End If
                Loop
                'Look up the crust style
                .sytleComboBox.SelectedText = Decimal.Parse(Me.sytleComboBox.SelectedText)
                Do Until stylefoundboolean Or indexinteger > 3
                    If indexinteger = .sytleComboBox.SelectedText Then
                        stylestring = indexinteger
                        stylefoundboolean = True
                    Else
                        indexinteger += 1
                    End If
                Loop

                'Display the pizza price
                Dim pricedecmial As Decimal

                If pizzafoundboolean And stylefoundboolean Then
                    Me.pizzaTextBox.Text = pricedecimal(indexinteger).ToString("C")
                End If

            Catch ex As Exception
                MessageBox.Show("Select size and style.", "Information missing", MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
            End Try
        End With

Edited 6 Years Ago by __avd: Added [code] tags. For easy readability, always wrap programming code within posts in [code] (code blocks).

Use this to check if "pizzafoundboolean/stylefoundboolean" are true or not.:

]If pizzafoundboolean And stylefoundboolean Then
[B]MessageBox.Show(pricedecimal(indexinteger).ToString("C"));[/B]
Me.pizzaTextBox.Text = pricedecimal(indexinteger).ToString("C")
End If

If the MessageBox() is not shown then none of them are true.

Edited 6 Years Ago by farooqaaa: n/a

its not working. it states number of indicies is less than the number of dimensions of the indexed array. what now?

This article has been dead for over six months. Start a new discussion instead.