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
 
Ad

Advertisements

?

=?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
Property. Which one should I use? 3
Enumeration 1
Property. Control or View State? 1
Generic.List 1
Property problem. Please, need some help on this. 1
Is Nothing problem 16
Generic List. Remove duplicate 2

Top