diff --git a/GBM/Forms/frmAdvancedImport.Designer.vb b/GBM/Forms/frmAdvancedImport.Designer.vb index d27f728..4e81648 100644 --- a/GBM/Forms/frmAdvancedImport.Designer.vb +++ b/GBM/Forms/frmAdvancedImport.Designer.vb @@ -33,11 +33,9 @@ Partial Class frmAdvancedImport 'lstGames ' Me.lstGames.CheckOnClick = True - Me.lstGames.FormattingEnabled = True Me.lstGames.Location = New System.Drawing.Point(12, 30) Me.lstGames.Name = "lstGames" Me.lstGames.Size = New System.Drawing.Size(335, 334) - Me.lstGames.Sorted = True Me.lstGames.TabIndex = 1 ' 'btnImport diff --git a/GBM/Forms/frmAdvancedImport.vb b/GBM/Forms/frmAdvancedImport.vb index 737d27b..c6695e2 100644 --- a/GBM/Forms/frmAdvancedImport.vb +++ b/GBM/Forms/frmAdvancedImport.vb @@ -26,15 +26,22 @@ Public Class frmAdvancedImport Private Sub LoadData() Dim oApp As clsGame Dim oData As KeyValuePair(Of String, String) - - lstGames.ValueMember = "Key" - lstGames.DisplayMember = "Value" + Dim oList As New List(Of KeyValuePair(Of String, String)) For Each de As DictionaryEntry In ImportData oApp = DirectCast(de.Value, clsGame) oData = New KeyValuePair(Of String, String)(oApp.CompoundKey, oApp.Name & " (" & oApp.TrueProcess & ")") - lstGames.Items.Add(oData) + oList.Add(oData) Next + + oList.Sort(AddressOf mgrCommon.CompareByName) + + lstGames.BeginUpdate() + lstGames.DataSource = oList + lstGames.ValueMember = "Key" + lstGames.DisplayMember = "Value" + lstGames.EndUpdate() + lstGames.ClearSelected() End Sub Private Sub SetForm() diff --git a/GBM/Forms/frmGameManager.vb b/GBM/Forms/frmGameManager.vb index 574ed32..3c22b5d 100644 --- a/GBM/Forms/frmGameManager.vb +++ b/GBM/Forms/frmGameManager.vb @@ -371,10 +371,6 @@ Public Class frmGameManager End Function - Public Shared Function CompareByName(sItem1 As KeyValuePair(Of String, String), sItem2 As KeyValuePair(Of String, String)) As Integer - Return String.Compare(sItem1.Value, sItem2.value) - End Function - Private Sub FormatAndFillList() IsLoading = True @@ -382,20 +378,19 @@ Public Class frmGameManager Dim oData As KeyValuePair(Of String, String) Dim oList As New List(Of KeyValuePair(Of String, String)) - lstGames.ValueMember = "Key" - lstGames.DisplayMember = "Value" - For Each de As DictionaryEntry In AppData oApp = DirectCast(de.Value, clsGame) - oData = New KeyValuePair(Of String, String)(oApp.ID, oApp.Name) + oData = New KeyValuePair(Of String, String)(oApp.ID, oApp.Name) oList.Add(oData) Next - oList.Sort(AddressOf CompareByName) + oList.Sort(AddressOf mgrCommon.CompareByName) lstGames.BeginUpdate() lstGames.DataSource = oList - lstGames.EndUpdate() + lstGames.ValueMember = "Key" + lstGames.DisplayMember = "Value" + lstGames.EndUpdate() lstGames.ClearSelected() IsLoading = False End Sub diff --git a/GBM/Managers/mgrCommon.vb b/GBM/Managers/mgrCommon.vb index 5c0e9c0..f9f9ec1 100644 --- a/GBM/Managers/mgrCommon.vb +++ b/GBM/Managers/mgrCommon.vb @@ -251,6 +251,11 @@ Public Class mgrCommon Return sString End Function + 'Compare function for list boxes + Public Shared Function CompareByName(sItem1 As KeyValuePair(Of String, String), sItem2 As KeyValuePair(Of String, String)) As Integer + Return String.Compare(sItem1.Value, sItem2.value) + End Function + 'Maintenance Only - Function for string management Public Shared Sub GetAllStrings(ByVal ctlParent As Control, ByRef sResource As String, ByRef sCode As String, ByVal sFormName As String) For Each ctl As Control In ctlParent.Controls