ITGuy2010 0 Newbie Poster

Hello,
I want to create a sorted list, where I enter a name in two separate text boxes(Jones, Brown) and their values in two other textboxes(200,500), then in a fifth text box I enter one of the names and it gives me a messagebox with its corresponding value. Am I on the right track? Here is my code below. Thanks for any help you can provide!!

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

        Dim saleslist As New SortedList(Of String, Decimal)
        saleslist.Add(TextBox1.Text, TextBox2.Text)
        saleslist.Add(TextBox3.Text, TextBox4.Text)

        Dim employeeKey As String = TextBox5.Text
        Dim salestotal As Decimal = saleslist(employeeKey)
        Dim salestablestring As String = ""

        For Each employeesalesentry As KeyValuePair(Of String, Decimal) In saleslist
            salestablestring &= employeesalesentry.Key & vbTab & _
            employeesalesentry.Value & vbCrLf
        Next
        MessageBox.Show(salestablestring, "Sorted List Totals")

    End Sub
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.