Originally Posted by
reez88
Hi,
I have a stored procedure which returns UserID and UserName.
I need to display UserID|UserName in a dropdown and when a selection is made, only UserID needs to be displayed.
Could someone please direct me on how to achieve this?
Many Thanks.
Try this:
Public Class clsMyProcedure
Dim _us as String, _id as Integer
Public Sub New (us as String, id as Integer)
End Sub
Public ReadOnly Property UserName as String
End Property
Public ReadOnly Property UserID as Integer
End Property
Public Function Overrides ToString () as String
Return _us
End Function
End Class
You store a collection of objects clsMyProcedure and you get the UserName from ToString Function. You also have available the UserID from the UserID property.
You can declare a generic procedure like a list:
Dim myList as new List(Of clsMyProcedure)
myList.Add(New clsMyProcedure("John", 1))
I hope that help you.