mla_ca520
Member
Hello, the following code will update the combobox list with new entries and even move repeated entries to the top of the list. I want to save the list so that the next time a user opens the program, the previous list appears in the combobox. Not sure how to accomplish that.
Thanks in advance for any help you can give me.
Private Sub btnCheck_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCheck.Click
're-declare "strComputer" to get value from combobox "combComputer"
Dim strComputer As String = combComputer.Text
'check if value is in list, if not then add it at the top
If Not combComputer.Items.Contains(strComputer) Then
combComputer.Items.Insert(0, strComputer)
combComputer.SelectedIndex = 0
Else
'value was in list, delete it and add at top of list
combComputer.Items.Remove(strComputer)
combComputer.Items.Insert(0, strComputer)
combComputer.SelectedIndex = 0
End If
'update label with status of remote computer
statusLBL()
End Sub
Thanks in advance for any help you can give me.
Private Sub btnCheck_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCheck.Click
're-declare "strComputer" to get value from combobox "combComputer"
Dim strComputer As String = combComputer.Text
'check if value is in list, if not then add it at the top
If Not combComputer.Items.Contains(strComputer) Then
combComputer.Items.Insert(0, strComputer)
combComputer.SelectedIndex = 0
Else
'value was in list, delete it and add at top of list
combComputer.Items.Remove(strComputer)
combComputer.Items.Insert(0, strComputer)
combComputer.SelectedIndex = 0
End If
'update label with status of remote computer
statusLBL()
End Sub