There are a number of ways depending how you have your listbox setup and your requirements.
You could call Reverse on the collection that you are adding to the listbox. Also, if new items are added, you can use ListBox.Items.Insert. You also could clear the list, and add items back in any order you would like.
Probably for this general type of .NET forms question, PISquare is not the best place to start. I recommend a few general web searches to start.
3 of 3 people found this helpful
Incase you're still looking for assistance on this question, here's the exact VBA code that you could use to add an item to the beginning or the end of a Microsoft ListBox control on a Processbook display:
Note: Value1 is a value symbol displaying cdm158
Private Sub Value1_DataUpdate() Dim vDate As Variant Dim vStatus As Variant Dim vValue As Variant vValue = Value1.GetValue(vDate, vStatus) Call ListBox1.AddItem(vDate & " " & vValue) Call ListBox2.AddItem(vDate & " " & vValue, 0) End Sub
And here's how it looks on the display after the value has updated a few times.
Notice that Listbox1 is updating at the bottom and Listbox2 is updating at the top. This is handled by providing a value of 0 for the optional index parameter of the AddValue method.
Thank you Kelsey,
I ended up figuring it out the way that you just displayed. But thank you for the assistance