Here's a simple example of what Lee meant:
Dim users As New List(Of String)
For Each myUser As MembershipUser In Membership.GetAllUsers()
If myUser.IsOnline Then
Once this code is done, the users variable contains the names of on-line users.
Warning: with a large number of users this is likely to break. GetAllUsers has an overload that enables you to "page" your users which is a better alternative in terms of memory consumption and database locks.
You can also bypass the Membership API and use direct SQL to query just the names. Look in the Stored Procedures of a database using membership for some ideas on implementing this.
Hope this helps,