Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Windows Forms / Design Time / May 2004

Tip: Looking for answers? Try searching our database.

Password Property

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Dennes Oliveira - 04 May 2004 19:10 GMT
Hi !

I created a windows control with one password property. I would like that the password appear as "*" when typed in property window.

I tryed to create a TypeEditor for the password property and overrides the paintValue method, but this doesn't work. I have to problems in result : The "*" appears as a graphical element, not text, and the password still appears in clear text.

I don't know if I'm using the correct approach for this problem, can someone help ?

Thanks !

Public Class EditorSenha
   Inherits System.Drawing.Design.UITypeEditor

   Public Overloads Overrides Function GetEditStyle(ByVal context As System.ComponentModel.ITypeDescriptorContext) As System.Drawing.Design.UITypeEditorEditStyle
       GetEditStyle = System.Drawing.Design.UITypeEditorEditStyle.None
   End Function

   Public Overloads Overrides Function GetPaintValueSupported(ByVal context As System.ComponentModel.ITypeDescriptorContext) As Boolean
       Return (True)
   End Function

   Public Overloads Overrides Sub PaintValue(ByVal e As System.Drawing.Design.PaintValueEventArgs)
       Dim o As Object = e.Value
       Dim b As Brush = New SolidBrush(Color.Red)
       Dim f As Font = New Font("Times New Roman", 10)
       Dim g As Graphics = e.Graphics

       g.DrawString("*****", f, b, e.Bounds.X, e.Bounds.Y)

   End Sub

End Class

-----------------------

<Id>tZQxpQfLfU2bP2HEvv67rQ==</Id
Rami Saad - 09 May 2004 12:50 GMT
Hello,
Why don't you just use a normal text box, then sets its password character
property to the character you want? Such as the following:
textBox1.PasswordChar="*";
This will automatically make your text box act as password text box, with
the character you entered as property.
Hope this solves your problem.

Regards,
Rami Saad
MEA Developer Support Center
ITworx on behalf of Microsoft EMEA GTSC
Rami Saad - 11 May 2004 11:57 GMT
Hello,
Why don't you just use a normal text box, then sets its password character
property to the character you want? Such as the following:
textBox1.PasswordChar="*";
This will automatically make your text box act as password text box, with
the character you entered as property.
Hope this solves your problem.

Regards,

Rami Saad
MEA Developer Support Center
ITworx on behalf of Microsoft EMEA GTSC

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.