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.
Printable View
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)_us = us
_id = idEnd Sub
Public ReadOnly Property UserName as String
GetEnd Property
Return _usEnd Get
Public ReadOnly Property UserID as Integer
GetEnd Property
Return _idEnd Get
Public Function Overrides ToString () as StringEnd Class
Return _usEnd Function
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.