Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4067756
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T16:17:24+00:00 2026-05-20T16:17:24+00:00

I’m trying to do the following: Store items from ComboBox in My.Settings (datatype doesn’t

  • 0

I’m trying to do the following:

  1. Store items from ComboBox in My.Settings (datatype doesn’t matter, but need suggestions).
  2. Retrieve these items to populate a ComboBox on formload.
  3. Also display these items (1 item per line) in TextBox, where I can edit and save the edits to both My.Settings and the ComboBox.

I’m a little lost, how should I go about doing this?

Existing Code:

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

        Labels.LoadSettings()

        txtNumOfLabels.Text = Labels.numOfLabels

        cboItem.Items.Clear()
        For Each s As String In Labels.items
            cboItem.Items.Add(s)
        Next

    End Sub

    Public Shared items As New Specialized.StringCollection

    Shared Sub LoadSettings()
            Try
                items = My.Settings("Items")
            Catch ex As Exception
                MsgBox(ex.Message, MsgBoxStyle.Exclamation)
            End Try
        End Sub


 Private Sub Options_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        For Each s As String In Labels.items
            txtItems.AppendText(s + Environment.NewLine)
        Next
    End Sub

 Private Sub btnSave_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSave.Click
        Dim itemCollection As New Specialized.StringCollection
        For Each s As String In txtItems.Lines
            itemCollection.Add(s)
        Next

        My.Settings("Items") = itemCollection
        My.Settings.Save()
        Labels.LoadSettings()

        Form1.cboItem.Items.Clear()
        For Each s As String In Labels.items
            Form1.cboItem.Items.Add(s)
        Next

        Me.Close()
    End Sub

But this code won’t save the values properly, or display them properly in the combobox or textbox.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T16:17:24+00:00Added an answer on May 20, 2026 at 4:17 pm

    You could use a StringCollection type for your setting, you may need the following imports statement in your code for the StringCollection to be available: Imports System.Collections.Specialized

    You can then use this StringCollection as the DataSource for the combobox.

    Edit: Saw in your code that you already use StringCollection. Good. Now why don’t you access your setting like this?

    My.Settings.Items = itemCollection
    

    This way you’re sure not to make a typing mistake, and you’re also sure that you setting actually exists. Also did you try stepping through the code to check if your setting is actually saved or not?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to clean up various Word 'smart' characters in user input, including but
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
Basically, what I'm trying to create is a page of div tags, each has
I am trying to understand how to use SyndicationItem to display feed which is
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I want to count how many characters a certain string has in PHP, but
For some reason, after submitting a string like this Jack’s Spindle from a text
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I am trying to render a haml file in a javascript response like so:
I have a French site that I want to parse, but am running into

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.