0

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
3
Contributors
6
Replies
7
Views
5 Years
Discussion Span
Last Post by codeorder
0

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

0

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
0

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

0

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

0

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

0

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.

Edited by codeorder: n/a

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.