Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27554

VS 2010 Extracting information from a multidimensional array ?

$
0
0
I've tried just about every possible combination of code to extract just the first name from a multidimensional array set for only the first and last name. All I can get is the first name "Bob" which is positioned first in the array. The rest come out as a few letters of both the first and last name. Can anyone show me something I missed here?

Code:

Private Sub btnPlaceOrder_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnPlaceOrder.Click

        Dim strName, strFirst As String
        Dim intSpace As Integer
        Dim Row As Integer


        Row = cboCusNum2.SelectedIndex

        If cboCusNum2.SelectedIndex < 0 Then

            MsgBox("Must select a customer number")

            Exit Sub
        End If


        strName = CustInfo(Row, 0)
        intSpace = strName.IndexOf(" ")
        strFirst = strName.Substring(Row, intSpace).TrimStart


        intTotalQty += nudQuantity.Value
        decTotalSales += decFinalTotal

        MsgBox("Order of " & FormatCurrency(decFinalTotal) & " For " & (strFirst))

        Exit Sub

    End Sub

End Class

Code:

'  Global arrays for storing Customer Information
    Public CustNums() As String = {"1234", "3456", "5678", "7890"}
    Public CustInfo(,) As String = {{"Bob First", "One 1st St", "Single, MT"}, _
                                  {"Sue Third", "Three 3rd Ave", "Triple, AL"}, _
                                  {"Joe Fifth", "Five 5th Dr", "Quintuple, VT"},
                                  {"Ann Seventh", "Seven 7th Ln", "Heptagon, TX"}}


Viewing all articles
Browse latest Browse all 27554

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>