Create Account Saver with VB.NET 2008
Tuesday, November 16, 2010 by: Andy Kurnia Prayoga MadeDescription: This program was made with the programming language visual basic 2008. I give this program the name "URLMemory". Purposes of this program is to facilitate Internet users to remember the username and password on websites that you register. Example given in the e-mail account. These programs use a textfile as storage media databases. Manufacture is also very easy, just use the standard controls of Visual Basic 2008, which is used as textbox, combobox and others. Weakness of this program one of them is not using the password encryption methods so that in terms of security is still lacking. To encrypt the files will be discussed at the next program. Of course there are many more other deficiencies. To cover the following things give me the source code of this program. Good luck!
Imports Microsoft.VisualBasic
Imports System.Collections.ObjectModel
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim dpath As String = Application.StartupPath
Dim mydata As String
mydata = "url=" & ComboBox1.Text & "|username=" & TextBox1.Text & "|password=" & TextBox2.Text
My.Computer.FileSystem.WriteAllText(dpath & "\Data\" & ComboBox1.Text & ".txt", String.Empty, False)
My.Computer.FileSystem.WriteAllText(dpath & "\Data\" & ComboBox1.Text & ".txt", mydata, False)
ComboBox1.Items.Add(ComboBox1.Text)
MsgBox("Data sudah ditambahkan")
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim files As ReadOnlyCollection(Of String)
Dim fileContents As String
Dim myArray(5) As String, myUrl(2) As String, myUser(2) As String, myPass(2) As String
Dim dpath As String = Application.StartupPath
Dim folderExists As Boolean
folderExists = My.Computer.FileSystem.DirectoryExists(dpath & "\Data")
If Not (folderExists) Then
My.Computer.FileSystem.CreateDirectory(dpath & "\Data")
End If
files = My.Computer.FileSystem.FindInFiles(dpath & "\Data", "url", True, FileIO.SearchOption.SearchAllSubDirectories, "*.txt")
For i = 0 To files.Count - 1
fileContents = My.Computer.FileSystem.ReadAllText(files.Item(i))
myArray = Split(fileContents, "|")
myUrl = Split(myArray(0), "=")
ComboBox1.Items.Add(myUrl(1))
Next
End Sub
Private Sub ComboBox1_SelectedValueChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles ComboBox1.SelectedValueChanged
Dim dpath As String = Application.StartupPath
Dim fileContents As String
Dim myArray(5) As String, myUrl(2) As String, myUser(2) As String, myPass(2) As String
Dim fileExists As Boolean
fileExists = My.Computer.FileSystem.FileExists(dpath & "\Data\" & ComboBox1.Text & ".txt")
If fileExists Then
fileContents = My.Computer.FileSystem.ReadAllText(dpath & "\Data\" & ComboBox1.Text & ".txt")
myArray = Split(fileContents, "|")
myUrl = Split(myArray(0), "=")
myUser = Split(myArray(1), "=")
myPass = Split(myArray(2), "=")
TextBox1.Text = myUser(1)
TextBox2.Text = myPass(1)
End If
End Sub
Private Sub CheckBox1_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBox1.CheckedChanged
If CheckBox1.Checked Then
TextBox2.PasswordChar = Chr(7)
Else
TextBox2.PasswordChar = ""
End If
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Dim dpath As String = Application.StartupPath & "\Data\" & ComboBox1.Text & ".txt"
Dim files As ReadOnlyCollection(Of String)
Dim fileContents As String
Dim myArray(5) As String, myUrl(2) As String, myUser(2) As String, myPass(2) As String
Dim dpath2 As String = Application.StartupPath
My.Computer.FileSystem.DeleteFile(dpath, FileIO.UIOption.OnlyErrorDialogs, FileIO.RecycleOption.DeletePermanently)
ComboBox1.Text = ""
TextBox2.Text = ""
TextBox1.Text = ""
ComboBox1.Items.Clear()
files = My.Computer.FileSystem.FindInFiles(dpath2 & "\Data", "url", True, FileIO.SearchOption.SearchAllSubDirectories, "*.txt")
For i = 0 To files.Count - 1
fileContents = My.Computer.FileSystem.ReadAllText(files.Item(i))
myArray = Split(fileContents, "|")
myUrl = Split(myArray(0), "=")
ComboBox1.Items.Add(myUrl(1))
Next
MsgBox("Data sudah dihapus")
End Sub
Private Sub LinkLabel1_LinkClicked(ByVal sender As System.Object, ByVal e As System.Windows.Forms.LinkLabelLinkClickedEventArgs) Handles LinkLabel1.LinkClicked
Try
VisitLink()
Catch ex As Exception
' The error message
MessageBox.Show("Unable to open link that was clicked.")
End Try
End Sub
Sub VisitLink()
LinkLabel1.LinkVisited = True
System.Diagnostics.Process.Start("http://andy-study.blogspot.com")
End Sub
End Class 




