0

Im working on a console application which sends and receives data through a WinSock control. for each incremental stream that gets added to the buffer i have generated an array list and appended incoming integral address (IPv4) from the stream. however, while listing the data in another control, it appears in Unsorted manner.

Private Sub clrHandler_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles clrHandler.Click
dim clrReckon as Integer
clrReckon = PostCLRCount
PostCLRCount += 1
1
  • 1
    I notice you've misspelt Integer. You should always copy your code when posting, don't attempt to re-type it. Commented Aug 1, 2013 at 18:47

2 Answers 2

2

You could store the values in an Array, or other Collection, and use Array.Sort.

If you store them in separate variables then you would need to write the code that sorts them.

Sign up to request clarification or add additional context in comments.

3 Comments

Knowing how to use arrays is fundamental to any programming language, so you should study how to use them.
Yes. That's possible.
Yes, it will be possible.
0

Assuming you have 5 integer values for each of the button click counts, then you can order them in ascending order like this:

Public Class ButtonCount
Private m_Name As String
    Public Property Name() As String
        Get
            Return m_Name
        End Get
        Set
            m_Name = Value
        End Set
    End Property

    Private m_Count As Integer
    Public Property Count() As Integer
        Get
            Return m_Count
        End Get
        Set
            m_Count = Value
        End Set
    End Property

    Public Sub New(name As String, count As Integer)
        Name = name
        Count = count
    End Sub
End Class

Dim listButtonCount As New List(Of ButtonCount)()
listButtonCount.Add(New ButtonCount("A", aCount))
listButtonCount.Add(New ButtonCount("B", bCount))
listButtonCount.Add(New ButtonCount("C", cCount))
listButtonCount.Add(New ButtonCount("D", dCount))
listButtonCount.Add(New ButtonCount("E", eCount))

Note: aCount, bCount, cCount, dCount and eCount are the five Integer values you are keeping track of for clicks of the respective buttons.

Dim sortedListButtonCount As List(Of ButtonCount) = listButtonCount.OrderBy(Function(c) c.Count).ToList()

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.