|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Adding New member to TextBox..How can I add Sub or Function or property to be a member of TextBox ? For example TextBox1.Text , text is a property in Textbox1 How Can I add the following sub to be a member of textbox1: Public Sub SaveHtml(ByVal stream As Stream) If stream Is Nothing Then Throw New ArgumentNullException("SaveHtml : Must specify a non-null stream to which to save") End If Dim content As String = SaveHtml() Dim writer As New StreamWriter(stream, Encoding.UTF8) writer.Write(content) writer.Flush() End Sub 'SaveHtml Any Help or redirection will be appreciated regard's Husam
Show quote
Hide quote
"Husam" <Hu***@discussions.microsoft.com> wrote in message What you're talking about is extending the .NET Framework TextBox class.news:D2F57ED1-7509-4345-946D-7AC6EED979EA@microsoft.com... > Hi EveryBody: > > How can I add Sub or Function or property to be a member of TextBox ? > > For example TextBox1.Text , text is a property in Textbox1 How Can I add > the > following sub to be a member of textbox1: > > Public Sub SaveHtml(ByVal stream As Stream) > If stream Is Nothing Then > Throw New ArgumentNullException("SaveHtml : Must specify a > non-null stream to which to save") > End If > Dim content As String = SaveHtml() > Dim writer As New StreamWriter(stream, Encoding.UTF8) > writer.Write(content) > writer.Flush() > End Sub 'SaveHtml > > Any Help or redirection will be appreciated > > regard's > > Husam Something like this in a class module... Public Class MyTextBox Inherits TextBoxthen add your new method. Once you've got your new subclass defined, you should be able to call your method for instances of your new class. For details, search through your MSDN help for articles on "subclassing", "extending classes", "inheritance", etc. "Husam" <Hu***@discussions.microsoft.com> schrieb
http://msdn.microsoft.com/library/en-us/vbcn7/html/vaconInheritanceForBasicLanguage.asp
> Hi EveryBody: > > How can I add Sub or Function or property to be a member of TextBox > ? http://msdn.microsoft.com/library/en-us/vbcon/html/vbconControlCreation.asp Armin
Dates are Evil! HELP!
HttpWebRequest using Certificates Asynchronous Invoke and the UI thread (using delegates) How to use my default mail client to mail any file? Accessing Mdi Child Form Control form another one What's going on in this ADO2 code Cannot add MSWord reference Countdown/pause/resume timer Testing simple VB code in design time? .NET and MS Word : setting rightAlignment ??? |
|||||||||||||||||||||||