Click here to Skip to main content
15,881,089 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I wrote some code to read the contents of the fileconfig.
This resides in a form.
I would like, once the data is extracted, insert them in a listbox in the form1

this is the code

What I have tried:

Module ModuloConfig

    Sub MainConfig()
        ReadAllSettings() ' legge tutto il contenuto dell' app setting
     end sub  

    Sub ReadAllSettings() ' legge tutto l' appsetting
        Try
            Dim appSettings = ConfigurationManager.AppSettings

            If appSettings.Count = 0 Then
                Console.WriteLine("AppSettings is empty.") ' è vuoto
            Else
                For Each key As String In appSettings.AllKeys 'legge tutte le key
                    Console.WriteLine("Key: {0} Value: {1}", key, appSettings(key))

                Next
            End If
        Catch e As ConfigurationErrorsException
            Console.WriteLine("Error reading app settings")
        End Try
    End Sub
End Module
Posted
Updated 21-Feb-19 11:32am

my problem is not to create a list box but to transfer the data I got in the form to the listbox that is in the form. Maybe through a function call

i want to trasfert this:
key, appSettings(key)
 
Share this answer
 
v2
Comments
Dave Kreskowiak 21-Feb-19 17:58pm    
You posted this as an answer to your own question.

If you want to reply to someone, click the "Have a Question or Comment" button under the post you want to reply to. That way, the person you're replying to gets a notification that your posted a reply.
Dave Kreskowiak 21-Feb-19 17:59pm    
Now, you obviously didn't read the example code on the page that was linked to. It shows you how to add items to a ListBox.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900