Print Page | Close Window

Comboboxes and enumerated types

Printed From: IdeaBlade
Category: DevForce
Forum Name: DevForce Classic
Forum Discription: For .NET 2.0
URL: http://www.ideablade.com/forum/forum_posts.asp?TID=430
Printed Date: 25-Jan-2026 at 3:49pm


Topic: Comboboxes and enumerated types
Posted By: jcdk
Subject: Comboboxes and enumerated types
Date 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



Replies:
Posted By: davidklitzke
Date 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:
 
http://www.codeproject.com/dotnet/Localization.asp - http://www.codeproject.com/dotnet/Localization.asp
 


Posted By: Linguinut
Date 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:
http://www.ideablade.com/techtip_visual_grid_designer_dangers.htm - http://www.ideablade.com/techtip_visual_grid_designer_dangers.htm



Print Page | Close Window