I don't know if this helps, but I think you are heading in the wrong direction.
Let the DataGridView display how you would like to see and edit the data. Regarding your 'Gender' column, you should be able to setup your combobox column as follows:
Consider the following scenario: Your data table has a column 'Gender' which holds a 0 (unknown), 1(Male), 2(Female), 3(Other).
Here is a sample code which will define the lookup, creates sample data and populates the grid with data. The Gender will be displayed in english but stored as number.
class Employee
{
public string Name { get; set; }
public int Gender { get; set; }
}
class GenderLookup
{
public string Display { get; set; }
public int Value { get; set; }
}
private void SetupGrid()
{
GenderLookup[] _lookups = new[]
{
new GenderLookup { Value = 0, Display = "unknown" },
new GenderLookup { Value = 1, Display = "Male" },
new GenderLookup { Value = 2, Display = "Female" },
new GenderLookup { Value = 3, Display = "Other" }
};
Employee[] _employees = new[]
{
new Employee() { Gender = 1, Name = "James T. Kirk" },
new Employee() { Gender = 2, Name = "Lt. Uhura" },
new Employee() { Gender = 3, Name = "Data" }
};
GridView.AutoGenerateColumns = false;
GridView.DataSource = _employees;
GridView.Columns.Add(
new DataGridViewTextBoxColumn()
{
DataPropertyName = "Name"
}
);
GridView.Columns.Add(
new DataGridViewComboBoxColumn()
{
DataSource = _lookups,
DisplayMember = "Display",
ValueMember = "Value",
DataPropertyName = "Gender"
}
);
}
So there is no need to 'parse' (or better: translate) the gender display name manually. The DataGridView creates a 'view' of your underlying data, which might be hard to read (as with the gender information in this case).