Making a console application. Need to ask for a password. Which is the best way to do this considering I do not want the password to echo to the screen.
Thanks
Making a console application. Need to ask for a password. Which is the best way to do this considering I do not want the password to echo to the screen.
Thanks
Use Console.ReadKey(True) method to read the chars and conceal them.
Code:Console.Write("Password: ") Dim password As String = String.Empty Dim info As ConsoleKeyInfo Do info = Console.ReadKey(True) If info.Key = ConsoleKey.Enter Then Exit Do Else password &= info.KeyChar Console.Write("*"c) End If Loop Console.WriteLine() Console.WriteLine("you wrote: " & password) Console.ReadKey()
Some useful links: Learning videoes, Code Samples, WMI Code Creator, MSDN, The Code Project, WindowsClient.net, ASP.net, W3 Schools, Regular-Expressions.info, GDI+ FAQ
How to format posts with code blocks etc - present the problem/post properly
Thanks !!
Bookmarks