From 10a8ed201ddfe1f9ebcad2b4d737174673aedabc Mon Sep 17 00:00:00 2001
From: Michael Krisper <michael.krisper@tugraz.at>
Date: Fri, 18 Mar 2022 18:19:34 +0100
Subject: [PATCH] VehicleForm: corrected display of MotorPosition

---
 VECTO/GUI/VehicleForm.vb | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/VECTO/GUI/VehicleForm.vb b/VECTO/GUI/VehicleForm.vb
index 84f7e60edd..f91a8c0c23 100644
--- a/VECTO/GUI/VehicleForm.vb
+++ b/VECTO/GUI/VehicleForm.vb
@@ -127,9 +127,7 @@ Public Class VehicleForm
 
 		_changed = False
 
-		cbEmPos.ValueMember = "Value"
-		cbEmPos.DisplayMember = "Label"
-		cbEmPos.DataSource = [Enum].GetValues(GetType(PowertrainPosition)).Cast(Of PowertrainPosition).Select(Function(x) New With {Key .Value = x, .Label = x.GetLabel()}).ToList()
+		cbEmPos.DataSource = EnumHelper.GetKeyValuePairs(Of PowertrainPosition)(Function(t) t.GetLabel())
 
 		NewVehicle()
 	End Sub
@@ -570,7 +568,7 @@ Public Class VehicleForm
 				CbRtType.DataSource = EnumHelper.GetKeyValuePairs(Of RetarderType)(Function(t) t.GetLabel(), Function(t) t.IsOneOf(RetarderType.None, RetarderType.AxlegearInputRetarder))
 
 				tpTorqueLimits.Enabled = False
-				cbEmPos.DataSource = [Enum].GetValues(GetType(PowertrainPosition)).Cast(Of PowertrainPosition).Where(Function(x) x.IsBatteryElectric()).Select(Function(x) New With {Key .Value = x, .Label = x.GetLabel()}).ToList()
+				cbEmPos.DataSource = EnumHelper.GetKeyValuePairs(of PowertrainPosition)(function(t) t.GetLabel, function(x) x.IsBatteryElectric())
 				cbEngineStopStart.Checked = False
 				cbEngineStopStart.Enabled = False
 				cbEcoRoll.DataSource = {new with {.Key=EcoRollType.None, .Value=EcoRollType.None.GetName()}}
-- 
GitLab