locked
Convert text into password RRS feed

  • Question

  • How do i convert a text into password?

    ie. While logging into windows, we are entering our password character by character. how each characters are converted into * ?

    i dont know how to do this? pls help me.

     


    AmaranShiva
    Thursday, October 20, 2011 12:27 PM

Answers

  • you are telling the main problem in the end and all are answering in other sense.

    Console is different than text box.

    check following code

    Dim myPass As String

     

    If key.Key <> ConsoleKey.Backspace Then

     myPass = myPass + key.KeyChar

     Console.Write("*")

    Else

     If myPass.Length > 0 Then

     myPass = myPass.Substring(0, (myPass.Length - 1))

    Console.Write(vbBack & " " & vbBack)

    End If

    End If

     

     

     

    Hope it will give you some idea .


    Want to add MVP with my name.

    • Edited by bahushekh Friday, October 21, 2011 9:52 AM incomplete
    • Marked as answer by Mark Liu-lxf Thursday, October 27, 2011 1:34 AM
    Friday, October 21, 2011 9:35 AM

All replies

  • You don`t need to do this at all. Just put a TextBox control on your form and set the PasswordChar property to "*"
    Hannes

    If you have got questions about this, just ask.

    In a perfect world,
    users would never enter data in the wrong form,
    files they choose to open would always exist
    and code would never have bugs.

    C# to VB.NET: http://www.developerfusion.com/tools/convert/csharp-to-vb/
    • Proposed as answer by Cor Ligthert Thursday, October 20, 2011 5:44 PM
    Thursday, October 20, 2011 12:32 PM
  • Thank u  jordan. 

    How do i convert password into text ?


    AmaranShiva
    Friday, October 21, 2011 9:17 AM
  • thanks for ur reply.  

    i am creating a console application.  At there i need to convert the text into password. ie each character into password symbol 

     


    AmaranShiva
    Friday, October 21, 2011 9:21 AM
  • AmaranShiva,

    you can just take the value of the Text property. This "password" stuff is only about visualibility ( only showing the passwordchars ) it doesn`t change the real value of the typed characters.


    Hannes

    If you have got questions about this, just ask.

    In a perfect world,
    users would never enter data in the wrong form,
    files they choose to open would always exist
    and code would never have bugs.

    C# to VB.NET: http://www.developerfusion.com/tools/convert/csharp-to-vb/
    Friday, October 21, 2011 9:23 AM
  • you are telling the main problem in the end and all are answering in other sense.

    Console is different than text box.

    check following code

    Dim myPass As String

     

    If key.Key <> ConsoleKey.Backspace Then

     myPass = myPass + key.KeyChar

     Console.Write("*")

    Else

     If myPass.Length > 0 Then

     myPass = myPass.Substring(0, (myPass.Length - 1))

    Console.Write(vbBack & " " & vbBack)

    End If

    End If

     

     

     

    Hope it will give you some idea .


    Want to add MVP with my name.

    • Edited by bahushekh Friday, October 21, 2011 9:52 AM incomplete
    • Marked as answer by Mark Liu-lxf Thursday, October 27, 2011 1:34 AM
    Friday, October 21, 2011 9:35 AM
  • if you look in the code of the login template it should have this link that tells you how not to use it but it explains most of that sort of stuff

     

    http://msdn.microsoft.com/en-us/library/ms172766.aspx

     

     

    Friday, October 21, 2011 10:33 AM