These instructions assume VB2008 but I believe that 2010 is similar.
As @treaschf said, right click on your project in the Solution Explorer and select properties. If a window pops up with a title "Solution '...' Property Pages" then you clicked on the solution instead of the project. In the property window click on Settings. In the name column enter "Username", leave the type as String, the scope as User and the value as empty (unless you want to enter a default). Repeat this with each property that you want to store. These steps automatically create variables that you can access using My.Settings..
So in your code-behind you can do:
My.Settings.Username = "bob"
And:
Dim username as String = My.Settings.Username
I believe that settings will automatically be saved on exit but I recommend making an explicit call after updating just in case.
My.Settings.Save()
So that will pretty much do the same as you INI file used to do. But like @treaschf said, you should really encrypt the password when saving to disk. Below is a modified version of the routine found here. http://weblogs.asp.net/jgalloway/archive/2008/04/13/encrypting-passwords-in-a-net-app-config-file.aspx . I removed the System.Security.SecureString because as nice as it is it also makes life more complicated. Change the value of Entropy to anything you want, call Encrypt(string) to encrypt your text and Decrypt(string) to decrypt it. This uses DPAPI so you don't have to worry about messing with the registry, permissions and everything else.
Private Shared entropy As Byte() = System.Text.Encoding.Unicode.GetBytes("Enter some text here for entropy")
Public Shared Function EncryptString(ByVal text As String) As String
Dim data = System.Security.Cryptography.ProtectedData.Protect(System.Text.Encoding.Unicode.GetBytes(text), _
entropy, _
System.Security.Cryptography.DataProtectionScope.CurrentUser)
Return System.Convert.ToBase64String(data)
End Function
Public Shared Function DecryptString(ByVal encryptedData As String) As String
Dim data As Byte() = System.Security.Cryptography.ProtectedData.Unprotect(System.Convert.FromBase64String(encryptedData), _
entropy, _
System.Security.Cryptography.DataProtectionScope.CurrentUser)
Return System.Text.Encoding.Unicode.GetString(data)
End Function
And then to put it all together:
My.Settings.Username = EncryptString("bob")
Dim username As String
If Not String.IsNullOrEmpty(My.Settings.Username) Then
Try
username = DecryptString(My.Settings.Username)
Catch ex As Exception
'There was a problem decrypting the username
End Try
End If
Trace.WriteLine(username)