CheckBox

S

shapper

Hello,

I have an enumeration:

' Level
Public Enum Level
Professor
Student
' ...
End Enum ' Level

And a property of type Level:

' Levels
Private _Levels As Generic.List(Of Level)
Public Property Levels() As Generic.List(Of Level)
Get
Return _Levels
End Get
Set(ByVal value As Generic.List(Of Level))
_Levels = value
End Set
End Property ' Levels

I need to display, in my web page, N CheckBoxes which one showing a
Level.

Then I want to check the CheckBoxes which value exists in the property
Levels (Generic List).

How can I do this?

Thanks,

Miguel
 
?

=?ISO-8859-1?Q?G=F6ran_Andersson?=

shapper said:
Hello,

I have an enumeration:

' Level
Public Enum Level
Professor
Student
' ...
End Enum ' Level

And a property of type Level:

' Levels
Private _Levels As Generic.List(Of Level)
Public Property Levels() As Generic.List(Of Level)
Get
Return _Levels
End Get
Set(ByVal value As Generic.List(Of Level))
_Levels = value
End Set
End Property ' Levels

I need to display, in my web page, N CheckBoxes which one showing a
Level.

Then I want to check the CheckBoxes which value exists in the property
Levels (Generic List).

How can I do this?

Thanks,

Miguel

Loop through the values in the enum:

ForEach levelItem As Level in Enum.GetValues(GetType(Level))
...
Next

(I am not sure about the GetType(Level) part, that is supposed to return
the type of the enum.)

The levelItem variable will contain each of the values, so that you can
create a control for each of them and add it to the page. You can use
levelItem.ToString() to get the level value as a string so that you can
construct a unique id for each control.

You can use the Contains method on the list of levels to determine if a
specific level value exists in the list.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Property. 3
Is Nothing problem 16
Property. Which one should I use? 3
Generic List to Array 2
Property. Control or View State? 1
Control / Property. Going crazy here. 1
Property 1
Enumeration 1

Members online

Forum statistics

Threads
473,733
Messages
2,569,440
Members
44,831
Latest member
HealthSmartketoReviews

Latest Threads

Top