How can i make a configuration in INI and XML so that i won't hardcode the location of my database and other configurations, and i would just change it from a form within my program? Can anyone help me? thanks..

Usually VS saves connectionstrings in .config file or .settings file which is xml formatted. to do it yourself vs main menu Project->Add new item->.settings file
Add your items in this settings file, you're now can modify your settings without modifying your code.
Avoid using ini files, xml is better.

Thanks! is there a way that i can do it using my program in vb? like having a form where i can edit all the settings for my program in xml?

Sure, you've ml file and you also have System.Xml namespace which contains a lot of classes to add\remove and edit some nodes in xml files...

I'm kind lost there.. Can you teach me how? a little sample code will do, if you don't mind..

I'm kind lost there.. Can you teach me how? a little sample code will do, if you don't mind..

Create a new dialog form and use it to manipulate configuration items. On form_load add the items from your program settings:

Private Sub frmConfig_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        '
        '   Set the default values into the controls via the program settings
        '
        bLoading = True
        Me.txtServer.Text = My.Settings.Server
        Me.txtDB.Text = My.Settings.Database       
        bLoading = False
    End Sub

Set flags if they change any of the values and then on the OK_Button_Click test for changes and save them if they exist:

Private Sub OK_Button_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles OK_Button.Click
        '
        '   See if we have anything to save
        '
        If Me.bServerChanged Then
            My.Settings.Server = Me.txtServer.Text
        End If
        If Me.bDBChanged Then
            My.Settings.Database = Me.txtDB.Text
        End If
        '
        '   If anything changed, save the changes to the setting file
        '
        If Me.bServerChanged Or Me.bDBChanged Then
            My.Settings.Save()
        End If
        Me.DialogResult = System.Windows.Forms.DialogResult.OK
        Me.Close()
    End Sub

I want to have a configuration settings editor for my program with mysql.. I want the users to be able to switch from one server to the other using a form. If ill be making an installer for my project where would the config go? can it be read by the application still? or will i specify a path where the application will read its settings..

From VS main menu Project->Add new item select .settings file, once you've added it a designer (tabular) form allows you to add variables add ServerName and assign it a default value.
In coding let's the connection string static except the server name dynamic from the settings file.

This article has been dead for over six months. Start a new discussion instead.