New Posts New Posts RSS Feed: Comboboxes and enumerated types
  FAQ FAQ  Forum Search   Calendar   Register Register  Login Login

Comboboxes and enumerated types

 Post Reply Post Reply
Author
jcdk View Drop Down
Newbie
Newbie


Joined: 25-Aug-2007
Location: Denmark
Posts: 11
Post Options Post Options   Quote jcdk Quote  Post ReplyReply Direct Link To This Post Topic: Comboboxes and enumerated types
    Posted: 17-Sep-2007 at 6:47am
Hi
 
I am facing the following scenario:
 
In my database I have a field which can have the values 0, 1 and 2. These values corresponds to statuses, Waiting, Running, Finished. I want a Combobox on my form, where I can select one of the 3 statuses and have it write the appropriate number back to the database.
 
I realise that I can do a Property in my Model class ie
 
Public Property StatusString as String
  Get
     Select Case Me.Status
       Case 0
         Return "Waiting"
        ...
  End Get
  Set
       ...
  End Set
End Property
 
but the problem is that the application is supposed to be multilingual, and I don't really want the translation issues to go into the datamodel.
 
So, what I would prefer is a way to assign the valid values to the ComboBox on FormLoad and then bind the SelectedIndex of the ComboBox to the BindingSource using the ControlBindingManager. Is it possible to do something like that?
 
Any help appriciated.
 
Best regards
Jesper Carstensen
Back to Top
davidklitzke View Drop Down
IdeaBlade
IdeaBlade
Avatar

Joined: 14-Jun-2007
Posts: 715
Post Options Post Options   Quote davidklitzke Quote  Post ReplyReply Direct Link To This Post Posted: 18-Sep-2007 at 10:35am
You could create a one-off solution that would work for you, but the correct approach (especially in the long term) is to view this problem as not a DevForceproblem, but a .NET problem.  In particular, you will want use localization and resource files.  There are many articles on the web about this problem.  Here is one that you might want to start with:
 
 
Back to Top
Linguinut View Drop Down
Senior Member
Senior Member
Avatar

Joined: 14-Jun-2007
Location: United States
Posts: 394
Post Options Post Options   Quote Linguinut Quote  Post ReplyReply Direct Link To This Post Posted: 18-Sep-2007 at 1:39pm
This may have more information than you probably need, but I think it may address part of your combobox issue:
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down