I want to manually add two items as "Active" and "Inactive" in a ListBox. When the user selects "Active", i want to get the value "A" and when "Inactive" is selected, i want to get "I".
How do i do this in VB.NET.
Regards, George
I want to manually add two items as "Active" and "Inactive" in a ListBox. When the user selects "Active", i want to get the value "A" and when "Inactive" is selected, i want to get "I".
How do i do this in VB.NET.
Regards, George
Are you using .NET 4? If so, the simplest solution is probably to use Tuple(Of String, String)
. Create a tuple of ("Active", "A") and another of ("Inactive", "I") and add those to the listbox. Then set the listbox's DisplayMember
property to "Item1" and ValueMember
to "Item2".
Or you could do the same sort of thing with an anonymous type.