Make Sure The Last Item of a Listview Box is Always Visable

Category:
C#, VB.NET, ASP.NET
Type:
Snippets
Difficulty:
Beginning
Author:
Brent Coppock

Version Compatibility: Visual Basic 6, Visual Basic.NET

More information:
When programming a viewer that displays the messages from a log, you usually want it sorted historically with the most recent log/event at the bottom. Also, you want that last line to appear at the bottom. This line of code, placed at the bottom of your procedure that loads or adds an item to your listview, will enable this by invoking the EnsureVisible method.

Instructions: Copy the declarations and code below and paste directly into your VB project.

Declarations:

Code: