DropDownList Issue

S

shapper

Hello,

I have an Enumeration as follows:

Public Enum City
NewYork
London
End Enum

I have a function which returns a string for each City for different
culture:

Public Function City2String(ByVal myCity As City, ByVal culture As
CultureInfo) As String
Select Case culture.Name
Case "pt-PT"
Select Case city
Case Enumeration.City.NewYork
Return "Nova Iorque"
Case Enumeration.City.London
Return "Londres"
...
End Select
End Function

I have a Profile variable named MyCity of type City.

I need to populate the DropDownList with all EnumValues using
City2String to show the text in the correct culture (THIS IS DONE).

Then I need to make something as Profile.MyCity = Selelected Value in
ddlCity.

What should be the best way to do this?

Remember that a DropDownList only has strings. The only think I can
think off is to create a function String2City for all cultures.

However this seems a waste of code.

Any idea?

Thanks,

Miguel
 

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

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,230
Members
46,816
Latest member
SapanaCarpetStudio

Latest Threads

Top