Fixed some minor list box issues

This commit is contained in:
Michael J. Seiferling
2016-03-08 20:41:46 -06:00
parent 039f47fccd
commit 09c7bf8f05
4 changed files with 21 additions and 16 deletions
-2
View File
@@ -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
+11 -4
View File
@@ -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()
+3 -8
View File
@@ -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,19 +378,18 @@ 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)
oList.Add(oData)
Next
oList.Sort(AddressOf CompareByName)
oList.Sort(AddressOf mgrCommon.CompareByName)
lstGames.BeginUpdate()
lstGames.DataSource = oList
lstGames.ValueMember = "Key"
lstGames.DisplayMember = "Value"
lstGames.EndUpdate()
lstGames.ClearSelected()
IsLoading = False
+5
View File
@@ -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