Click here to Skip to main content
15,886,362 members
Articles / Desktop Programming / Windows Forms

Declarations Generator

Rate me:
Please Sign up or sign in to vote.
4.50/5 (2 votes)
29 Jun 2010GPL33 min read 19.4K   127   5  
A tool which helps in generating codes for events/properties, so that users of your classes can use events/properties of embedded classes
Public Class frm_CodeViewer

    Private m_GeneratedCode As String
    Public Property GeneratedCode() As String
        Get
            Return m_GeneratedCode
        End Get
        Set(ByVal value As String)
            m_GeneratedCode = value
            Me.txt_GenertedCode.Text = CodeAuthorSignature() & value
        End Set
    End Property

  
    Private Function CodeAuthorSignature() As String
        Dim AppInfo = My.Application.Info
        Dim _CodeAuthorSignature As String = _
                    "'Next Code is autogenerated " & vbCrLf & _
                    "'By a Tool '" & AppInfo.ProductName & "'" & vbCrLf & _
                    "'Version " & AppInfo.Version.ToString & vbCrLf & _
                    "'Done By Yasser Daheek" & vbCrLf & _
                    "'cotact with the Author yasserdaheek@windowslive.com" & vbCrLf & _
                    "'-----------------------------------------" & vbCrLf

        Return _CodeAuthorSignature

    End Function

    Private Sub btn_Export_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn_Export.Click
        Dim TargetFile As String = ""
        TargetFile = FilesDealer.GetFilePath("Choose the File to save the declarations to", _
                                             "Text Files (*.txt)|*.txt|vb Codes (*.vb)|*.vb")
        If TargetFile = "" Then
            Exit Sub
        End If
        My.Computer.FileSystem.WriteAllText(TargetFile, Me.txt_GenertedCode.Text, False)
    End Sub

    Private Sub btn_CopyToClipboard_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn_CopyToClipboard.Click
        My.Computer.Clipboard.SetText(Me.txt_GenertedCode.Text)
    End Sub
End Class

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The GNU General Public License (GPLv3)


Written By
Software Developer
Syrian Arab Republic Syrian Arab Republic
The more I learn the more I see my ignorance.

Comments and Discussions