Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. change password

change password

Scheduled Pinned Locked Moved Visual Basic
helptutorial
8 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • B Offline
    B Offline
    bapu2889
    wrote on last edited by
    #1

    Hello i am trying to add password in my one of exercise and it's works fine but when i try to change it it's not changeing at all i have set txtpassword.tag = "bapu" in property window and code for click event is Private Sub Button3_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click ClickCount += 1 If ClickCount = 1 Then MsgBox("Please enter your old password", MsgBoxStyle.Information) ElseIf ClickCount = 2 Then If txtPassWord.Text = txtPassWord.Tag Then MsgBox("Please enter your new password", MsgBoxStyle.Information) txtPassWord.Tag = Nothing : txtPassWord.Focus() : txtPassWord.Text = "" Else MsgBox("Wrond", MsgBoxStyle.Information) End If ElseIf ClickCount = 3 Then txtPassWord.Tag = txtPassWord.Text MsgBox("Password changed", MsgBoxStyle.Information) End If End Sub any help how to deal with this :confused: waiting for your kind rep. have a nice day

    M C 2 Replies Last reply
    0
    • B bapu2889

      Hello i am trying to add password in my one of exercise and it's works fine but when i try to change it it's not changeing at all i have set txtpassword.tag = "bapu" in property window and code for click event is Private Sub Button3_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click ClickCount += 1 If ClickCount = 1 Then MsgBox("Please enter your old password", MsgBoxStyle.Information) ElseIf ClickCount = 2 Then If txtPassWord.Text = txtPassWord.Tag Then MsgBox("Please enter your new password", MsgBoxStyle.Information) txtPassWord.Tag = Nothing : txtPassWord.Focus() : txtPassWord.Text = "" Else MsgBox("Wrond", MsgBoxStyle.Information) End If ElseIf ClickCount = 3 Then txtPassWord.Tag = txtPassWord.Text MsgBox("Password changed", MsgBoxStyle.Information) End If End Sub any help how to deal with this :confused: waiting for your kind rep. have a nice day

      M Offline
      M Offline
      Marc Soleda
      wrote on last edited by
      #2

      It's changed!!! Debug it and watch the txtPassWord.Tag at the end of the process...

      ... she said you are the perfect stranger she said baby let's keep it like this... Dire Straits

      B 1 Reply Last reply
      0
      • M Marc Soleda

        It's changed!!! Debug it and watch the txtPassWord.Tag at the end of the process...

        ... she said you are the perfect stranger she said baby let's keep it like this... Dire Straits

        B Offline
        B Offline
        bapu2889
        wrote on last edited by
        #3

        hi thanks for your kind rep. yes you are right but if i close the application and run it again the the password remains same as old pasword it's not changing the default password, because waht if user want to change password ? waiting for your kind rep. have a nice day

        M 1 Reply Last reply
        0
        • B bapu2889

          Hello i am trying to add password in my one of exercise and it's works fine but when i try to change it it's not changeing at all i have set txtpassword.tag = "bapu" in property window and code for click event is Private Sub Button3_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click ClickCount += 1 If ClickCount = 1 Then MsgBox("Please enter your old password", MsgBoxStyle.Information) ElseIf ClickCount = 2 Then If txtPassWord.Text = txtPassWord.Tag Then MsgBox("Please enter your new password", MsgBoxStyle.Information) txtPassWord.Tag = Nothing : txtPassWord.Focus() : txtPassWord.Text = "" Else MsgBox("Wrond", MsgBoxStyle.Information) End If ElseIf ClickCount = 3 Then txtPassWord.Tag = txtPassWord.Text MsgBox("Password changed", MsgBoxStyle.Information) End If End Sub any help how to deal with this :confused: waiting for your kind rep. have a nice day

          C Offline
          C Offline
          Christian Graus
          wrote on last edited by
          #4

          Obviously, changing hte password in memory does not change your code. So, you need to write code to persist the password. Naturally, if you just store it as plain text in an XML file or the registry, people can just look it up, to get into the program. So, you need to encrypt it somehow.

          Christian Graus Please read this if you don't understand the answer I've given you "also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )

          B 1 Reply Last reply
          0
          • B bapu2889

            hi thanks for your kind rep. yes you are right but if i close the application and run it again the the password remains same as old pasword it's not changing the default password, because waht if user want to change password ? waiting for your kind rep. have a nice day

            M Offline
            M Offline
            Marc Soleda
            wrote on last edited by
            #5

            The code you wrote changes the password just during the execution of the application. When you starts it again the password is recovered with the one you have in the Tag property. If you one that the change persists then you'll have to store it outside the code and get and set it when you want. Maybe the easiest way would be to store in one of the project settings. For example: My.Settings.Pwd and get it when the application load the main form Marc

            ... she said you are the perfect stranger she said baby let's keep it like this... Dire Straits

            1 Reply Last reply
            0
            • C Christian Graus

              Obviously, changing hte password in memory does not change your code. So, you need to write code to persist the password. Naturally, if you just store it as plain text in an XML file or the registry, people can just look it up, to get into the program. So, you need to encrypt it somehow.

              Christian Graus Please read this if you don't understand the answer I've given you "also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )

              B Offline
              B Offline
              bapu2889
              wrote on last edited by
              #6

              Thank you sir for your rep. but main thing is how ??????:confused: any clue as you said so do i need to store this password in any file within the folder or some thing else waiting for your kind rep.

              C 1 Reply Last reply
              0
              • B bapu2889

                Thank you sir for your rep. but main thing is how ??????:confused: any clue as you said so do i need to store this password in any file within the folder or some thing else waiting for your kind rep.

                C Offline
                C Offline
                Christian Graus
                wrote on last edited by
                #7

                File.SaveAllText and File.ReadAllText will give you file access. How you encode it, is up to you.

                Christian Graus Please read this if you don't understand the answer I've given you "also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )

                B 1 Reply Last reply
                0
                • C Christian Graus

                  File.SaveAllText and File.ReadAllText will give you file access. How you encode it, is up to you.

                  Christian Graus Please read this if you don't understand the answer I've given you "also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )

                  B Offline
                  B Offline
                  bapu2889
                  wrote on last edited by
                  #8

                  Hello sir how are you yes job done thank you again for helping me with this is what i have done Dim MyFile, FileName, LoadPW As String Dim MyIFile As String = Application.StartupPath + "\Password" Private Sub CreatePassword() Dim DataWriter As System.IO.StreamWriter FileName = "dk.txt" DataWriter = File.CreateText(Application.StartupPath + "\Password\" + FileName) DataWriter.Write(txtPassWord.Text) DataWriter.Close() End Sub Private Sub LoadMyPW() Dim DataReader As System.IO.StreamReader DataReader = File.OpenText("Password\dk.txt") FileName = DataReader.ReadToEnd LoadPW = FileName DataReader.Close() End Sub so it's working fine but still i have to do few changes with this code about encodeing which i will do it 2 moro so thank you very much sir for your help and thanks all who helped me with this thanks have a nice day to all :-D :rose:

                  1 Reply Last reply
                  0
                  Reply
                  • Reply as topic
                  Log in to reply
                  • Oldest to Newest
                  • Newest to Oldest
                  • Most Votes


                  • Login

                  • Don't have an account? Register

                  • Login or register to search.
                  • First post
                    Last post
                  0
                  • Categories
                  • Recent
                  • Tags
                  • Popular
                  • World
                  • Users
                  • Groups