how to reset the existing password(topsecret)with a new password by using the "replace" keyword

in the below code shown

Public Class Form1

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click

        System.Diagnostics.Process.Start("chrome.exe")

    End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Try

            If TextBox1.Text = "topsecret" Then

                Form2.ShowDialog()


            End If

        Catch ex As Exception

            MsgBox("Invalid Password", MsgBoxStyle.OkOnly, "Ok")

        End Try
    End Sub

Recommended Answers

All 6 Replies

u can do this in this way

dim myPass as string 
mypass = "TopSecret"
'now use this in ur if statement ,
'now if u want to change the password then place this code on ur replace button
mypass = ""
mypass = txtReplacePass.text
'now ur pass is changed

hope this will helps u , if ur prob is solved Please mark this thread solved

Regards
M.Waqas Aslam

See if this helps.
.you will need a Form3 w/a TextBox on it.

Imports System.IO
Public Class Form1
    Private myPasswordFile As String = Environment.GetFolderPath(Environment.SpecialFolder.Desktop) & "\myPasswordFile.txt"
    Private sPassword As String = Nothing '// string to hold your password.

    Private Sub Form1_FormClosing(sender As Object, e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing
        File.WriteAllText(myPasswordFile, sPassword) '// save.Password to File.
    End Sub

    Private Sub Form1_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
        If File.Exists(myPasswordFile) Then
            sPassword = File.ReadAllText(myPasswordFile) '// load password.
        Else
            sPassword = "!@(*&^$*()%$%_)(*^&*(" '// set a dummy.Password If no pre.saved password.
        End If
    End Sub

    Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click

    End Sub

    Private Sub Button2_Click(sender As System.Object, e As System.EventArgs) Handles Button2.Click
        Select Case TextBox1.Text
            Case sPassword, "top.secret"
                Form2.ShowDialog()
            Case "replace"
                With Form3
                    .ShowDialog()
                    sPassword = .TextBox1.Text
                    MsgBox("Password Replaced")
                End With
            Case Else
                    MsgBox("Invalid Password", MsgBoxStyle.OkOnly, "Ok")
        End Select
    End Sub
End Class

u can do this in this way

dim myPass as string 
mypass = "TopSecret"
'now use this in ur if statement ,
'now if u want to change the password then place this code on ur replace button
mypass = ""
mypass = txtReplacePass.text
'now ur pass is changed

hope this will helps u , if ur prob is solved Please mark this thread solved

Regards
M.Waqas Aslam

can you help me out any other Technic to reset the existing password with out using database please

Asslam u allikum !

bro if u dont want to use db , then i think u should use xml to save ur password ,
Regards

M.Waqas Aslam

Asslam u allikum !

bro if u dont want to use db , then i think u should use xml to save ur password ,
Regards

M.Waqas Aslam

ok fine . just tell me how would you do by using xml fle

Saving to .xml is just as saving to .txt, just more modern.

If you really want to keep your password.secure, encrypt/decrypt it.
Here's something simple for vb.noobs:http://www.daniweb.com/software-development/vbnet/threads/375789

Since I have Not had much use for vb.net and passwords, I can only presumme that saving the password to the Registry, after encrypting, would be the most secure way to do, for a vb.noob.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.