This should work:
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load ' You need to add a reference to System.Configuration ' Uncomment to get the count: ' Dim count As Int32 ' count = Configuration.ConfigurationManager.ConnectionStrings.Count Dim current As Configuration.ConnectionStringSettings For Each current In Configuration.ConfigurationManager.ConnectionStrings ListBox1.Items.Add(current.Name) Next End Sub
Note. Unless you have instructions in your app.config, you will probably also get LocalSqlServer, as defined by default in Machine.config.
source share