| You are here: DEVPPL ‹ Forum ‹ Programming ‹ Visual Basic Forum |
NOTIFICATIONS
|
|
|||||||||||||||
Login |
Listbox data extract after data entry & sort
1 post
• Page 1 of 1
0
Listbox data extract after data entry & sort
Hi All,
I'm at an impasse that I hope someone might be able to assist with.
I have an application that receives data input from an automated set of devices. This data stream I have managed to capture & get it into a list box which I can sort based on the Device ID & the time that the response was received.
There is a set time window for the devices to transmit their data into the application and during this each device is not limited to the number of responses it can send (ie :- Device 1 can send in 2 responses where Device 3 can send in 40 responses, etc).
All of the responses are captured, listed & sorted within the listbox (this bit is working ).
I now need to extract the last (ie:- latest) entry in the listbox for each Device ID & this is where I am stuck. I can retrieve the last item in the list but cant seem to extract the last item for each Device ID.
The code that I am using for the Device response capture, etc is :-
*********Code Start
Private Sub btnPoll_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnPoll.Click
'Sorts the contents of the listbox into ascending order lstResponses.Sorted = True
' Check the polling status to see whether we need to Start or End Polling.
If oDevices.IsPolling = False Then
' Clear out responses from the last poll.
lstResponses.Items.Clear()
Else
' Close Polling
oDevices.EndPoll()
' Update Button text
btnPoll.Text = "Start Polling"
End If
End Sub
Private Sub oDevices_Response(ByVal ReceiverId As String, ByVal DeviceId_ As String, ByVal Response As String) Handles oDevices.Response
' Handles the Response Event - Returns all the Polling responses.
'Due to the posibility of multiple responses being received from the same
'Device ID time stamps to millisecond accuracy are included
Dim strDateString As String
strDateString = Format(Now, "HH:mm:ss.fff")
lstResponses.Items.Add(DeviceId & vbTab & strDateString & vbTab & Response)
End Sub
*********Code End
An example of the results is as follows :-
AB6C08 14:30:21.837 2
AB6C08 14:30:21.839 9
AB6C08 14:30:22.370 5
AB6C08 14:30:22.712 3
AB6C08 14:30:23.176 2
AB6C0C 14:30:21.210 7
AB6C0C 14:30:21.469 3
AB6C0C 14:30:21.721 6
AB6C0C 14:30:22.910 1
AB6C0D 14:30:23.964 8
From the example above I would need to extract just the following lines :-
AB6C08 14:30:23.176 2
AB6C0C 14:30:22.910 1
AB6C0D 14:30:23.964 8
Any ideas would be really helpful as I can't seem to find a way round this.
Thanks
Charles
I'm at an impasse that I hope someone might be able to assist with.
I have an application that receives data input from an automated set of devices. This data stream I have managed to capture & get it into a list box which I can sort based on the Device ID & the time that the response was received.
There is a set time window for the devices to transmit their data into the application and during this each device is not limited to the number of responses it can send (ie :- Device 1 can send in 2 responses where Device 3 can send in 40 responses, etc).
All of the responses are captured, listed & sorted within the listbox (this bit is working ).
I now need to extract the last (ie:- latest) entry in the listbox for each Device ID & this is where I am stuck. I can retrieve the last item in the list but cant seem to extract the last item for each Device ID.
The code that I am using for the Device response capture, etc is :-
*********Code Start
Private Sub btnPoll_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnPoll.Click
'Sorts the contents of the listbox into ascending order lstResponses.Sorted = True
' Check the polling status to see whether we need to Start or End Polling.
If oDevices.IsPolling = False Then
' Clear out responses from the last poll.
lstResponses.Items.Clear()
Else
' Close Polling
oDevices.EndPoll()
' Update Button text
btnPoll.Text = "Start Polling"
End If
End Sub
Private Sub oDevices_Response(ByVal ReceiverId As String, ByVal DeviceId_ As String, ByVal Response As String) Handles oDevices.Response
' Handles the Response Event - Returns all the Polling responses.
'Due to the posibility of multiple responses being received from the same
'Device ID time stamps to millisecond accuracy are included
Dim strDateString As String
strDateString = Format(Now, "HH:mm:ss.fff")
lstResponses.Items.Add(DeviceId & vbTab & strDateString & vbTab & Response)
End Sub
*********Code End
An example of the results is as follows :-
AB6C08 14:30:21.837 2
AB6C08 14:30:21.839 9
AB6C08 14:30:22.370 5
AB6C08 14:30:22.712 3
AB6C08 14:30:23.176 2
AB6C0C 14:30:21.210 7
AB6C0C 14:30:21.469 3
AB6C0C 14:30:21.721 6
AB6C0C 14:30:22.910 1
AB6C0D 14:30:23.964 8
From the example above I would need to extract just the following lines :-
AB6C08 14:30:23.176 2
AB6C0C 14:30:22.910 1
AB6C0D 14:30:23.964 8
Any ideas would be really helpful as I can't seem to find a way round this.
Thanks
Charles
- Charles
- Reputation: 0
- Posts: 2
- Joined: Mon Aug 15, 2011 12:30 pm
- Highscores: 0
- Arcade winning challenges: 0
Listbox data extract after data entry & sort - Sponsored results
- Sponsored results
|
|