|
-
Oct 14th, 2006, 12:39 PM
#1
Thread Starter
Lively Member
Help converting this class to VB.NET
Hello all, I've having some issues converting this class to VB.NET, can someone help?
http://davidkean.net/archive/2004/09/06/150.aspx
Thanks.
Last edited by Xcoder : 09-10-2001 at 12:45 AM.
-
Oct 14th, 2006, 05:14 PM
#2
Re: Help converting this class to VB.NET
I am not sure about this, just typed from top of my head.
VB Code:
Namespace System.Windows.Forms
Public Class PasswordTextBox
Inherits TextBox
Private Const ES_PASSWORD As Integer = 32
'No need for this, will behave like a default constructor
'And in VB, the keyword for constructor is [New] as opposed
'classname in C#
Public Sub New()
End Sub
'CreateParams is an in-built Property, and used under
'SecurityPermission Attribute
Protected Overrides Property CreateParams() As CreateParams
<SecurityPermission(SecurityAction.LinkDemand, UnmanagedCode:=True)> _
Get
'Base will become MyBase
Dim parameters As CreateParams = MyBase.CreateParams
'Or will replace |
parameters.Style = (parameters.Style Or ES_PASSWORD)
Return parameters
End Get
End Property
End Class
End Namespace
-
Oct 14th, 2006, 06:16 PM
#3
Thread Starter
Lively Member
Re: Help converting this class to VB.NET
Thanks, I will try it first thing monday morning.
Last edited by Xcoder : 09-10-2001 at 12:45 AM.
-
Oct 14th, 2006, 08:50 PM
#4
Re: Help converting this class to VB.NET
Harsh Gupta's is correct except for the "ReadOnly" specifier. A bug in Instant VB was also omitting the "ReadOnly" specifer for this particular case - this is fixed now.
VB Code:
#Region "Using directives"
Imports System
Imports System.Windows.Forms
Imports System.Security
Imports System.Security.Permissions
#End Region
Namespace System.Windows.Forms
Public Class PasswordTextBox
Inherits TextBox
Private Const ES_PASSWORD As Integer = 32
Public Sub New()
End Sub
Protected Overrides ReadOnly Property CreateParams() As CreateParams
<SecurityPermission(SecurityAction.LinkDemand, UnmanagedCode:=True)> _
Get
Dim parameters As CreateParams = MyBase.CreateParams
parameters.Style = (parameters.Style Or ES_PASSWORD)
Return parameters
End Get
End Property
End Class
End Namespace
Last edited by David Anton; Oct 14th, 2006 at 09:56 PM.
Reason: wording adjustment
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|