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 4555662
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T17:15:26+00:00 2026-05-21T17:15:26+00:00

I am trying to bind the ConnectionStringsSettingsCollection from my app.config file to a ListBox

  • 0

I am trying to bind the ConnectionStringsSettingsCollection from my app.config file to a ListBox in my WinForms app. For some reason, I can’t seem to do it by the following method:

lstMyListBox.DataSource = GetConnectionStrings()
lstMyListBox.DisplayMember = "Name"

I am able to do it by iterating over the collection and adding each ConnectionStringSetting to lstMyListBox.Items:

For Each settings As ConnectionStringSettings In GetConnectionStrings()
    lstMyListBox.Items.Add(settings)
Next
lstMyListBox.DisplayMember = "Name"

Which works as far as modifying the individual items that are already in the collection, but I would like it if I remove something from the ListBox that it is removed from the underlying collection. Is there something I can do different that will allow me to bind the ListBox directly to the ConnectionStringSettingsCollection?

  • 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-21T17:15:27+00:00Added an answer on May 21, 2026 at 5:15 pm

    ConnectionStringsSettingsCollection doesn’t implement IList or IListSource, so it can’t be used as a DataSource. Instead you can bind a list of ConnectionStringSettings:

    lstMyListBox.DataSource = GetConnectionStrings().Cast(Of ConnectionStringSettings).ToList()
    lstMyListBox.DisplayMember = "Name"
    

    However the DisplayMember doesn’t seem to be taken into account, at least not for all items… but it works fine if you use “ConnectionString” as the DisplayMember. Not sure why…

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

Sidebar

Related Questions

I trying to bind List to Listbox. And at the Button1Click method new instance
I'm trying to bind the following shortcut: Ctrl + W to close tabs How
I am trying to bind an event to a method of a particular instance
i'm trying to create a ObjectDataSource which I can use to bind to a
I'm trying to bind a collection to a ListBox using only XAML. It kind
I'm trying to bind columns from two different tables in to gridview using Linq
I am trying to bind the data from linq xml in isolated storage. The
I am trying bind my application just to my VPS. Can you please tell
I'm trying to bind the selected value from the date picker to an asp
Im trying to bind a list of images to a Listbox, but all I

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.