locked
app.config file multiple values -VB.net RRS feed

  • Question

  • Hi,

        <add key="Youtube" value="www.youtube.com" />
            <add key="Google" value="www.google.com />
            <add key="Yahoo" value="www.yahoo.com" />

    The above is my app_config file. How will i get the add key value(Youtube,Google Yahoo) to my winform in vb.net.

    I am getting the URL values. and its loading .. BUt this names also i need... Is there any other way to pass these names(Youtube,Google Yahoo) in VB.net.. Please help

    Wednesday, August 19, 2020 8:40 AM

Answers

  • This should give names and values

    Dim allKeys = ConfigurationManager.AppSettings.AllKeys
    
    For Each configKey In allKeys
        Console.WriteLine($"{configKey} = {ConfigurationManager.AppSettings(configKey)}")
    Next


    Please remember to mark the replies as answers if they help and unmarked them if they provide no help, this will help others who are looking for solutions to the same or similar problem. Contact via my Twitter (Karen Payne) or Facebook (Karen Payne) via my MSDN profile but will not answer coding question on either.

    NuGet BaseConnectionLibrary for database connections.

    StackOverFlow
    profile for Karen Payne on Stack Exchange

    • Marked as answer by meeraluv Wednesday, August 19, 2020 11:42 AM
    Wednesday, August 19, 2020 11:16 AM

All replies

  • This should give names and values

    Dim allKeys = ConfigurationManager.AppSettings.AllKeys
    
    For Each configKey In allKeys
        Console.WriteLine($"{configKey} = {ConfigurationManager.AppSettings(configKey)}")
    Next


    Please remember to mark the replies as answers if they help and unmarked them if they provide no help, this will help others who are looking for solutions to the same or similar problem. Contact via my Twitter (Karen Payne) or Facebook (Karen Payne) via my MSDN profile but will not answer coding question on either.

    NuGet BaseConnectionLibrary for database connections.

    StackOverFlow
    profile for Karen Payne on Stack Exchange

    • Marked as answer by meeraluv Wednesday, August 19, 2020 11:42 AM
    Wednesday, August 19, 2020 11:16 AM
  • Thank  you Karen
    Wednesday, August 19, 2020 11:43 AM
  • Thank  you Karen
    Your welcome :-)

    Please remember to mark the replies as answers if they help and unmarked them if they provide no help, this will help others who are looking for solutions to the same or similar problem. Contact via my Twitter (Karen Payne) or Facebook (Karen Payne) via my MSDN profile but will not answer coding question on either.

    NuGet BaseConnectionLibrary for database connections.

    StackOverFlow
    profile for Karen Payne on Stack Exchange

    Wednesday, August 19, 2020 11:45 AM