To avoid deleting everything that is in the file, you need to use the StreamWriter’s constructor that specifies whether you want to append text to your file, or replace it.
Do it this way:
Dim objwriter As New System.IO.StreamWriter(FILE_NAME<b>, true</b>)
<a href=”http://msdn.microsoft.com/en-us/library/36b035cb.aspx”>StreamWriter Constructor (String, Boolean)</a>
But since you don’t want to append those lines to the file, but to replace them, you might want to open the file the way you was doing it, but before writing the user and password, you would need to write all the previous lines that the file contains before the current user and password. You are already opening the file for reading (to locate the uses and password), so it should not be too difficult.