locked
How do you view entire code? RRS feed

  • 問題

  • You can easily view codes of events (i guess its called public class) but how do u view all the codes of form properties, controls and everything. something that i can copy from one project to another and still have the whole thing.


    [UPDATE:  same thing as top but maybe saying this would help: how do i view code of things like the size property of a control and so on?  i have used the 2003 version and all that is already there under the code liine [Windows Form Designer] but i cant find it in my 2008
    2009年1月15日 1:18

解答

  • Hi Thakurabhi,

    If you want to display the codes of form properties, may be you can try the following.
    On the "Solution Explorer"
    Click on the "Show All Files" Button
    Which is between the "Properties" and "Refresh" button.

    Once you have clicked that.
    The Solution Explorer should display a lot of files/folder.

    You would need to click on the "+" sign on the form that you want to view the "Codes of the form properties" to expand the files. Then you will see there has a file called "Your Form Name".Designer.vb. Once you double click on that file. It should show you the code of the form's properties.

    Hope this can help.

    2009年1月15日 8:45
  • If you are going to look on the Form's properties code, you have to do another way.

     

    In VS.NET 2002/2003, right click the Form1.vb and select "View code" in the solution explorer. In the Code View, you will see a grey text "Windows Form Designer generated code" and these word are surround by a square. You can expand the designer code region by clicking the plus [+] symbol next to the region name.

     

    Inside the region, you will find a few key elements:

    • A constructor for the form (a Sub New() )

    • A Dispose procedure

    • Declarations of all of the controls on the form

    • A sub called InitializeComponent

    You will see something like this

    Code Snippet

    'NOTE: The following procedure is required by the Windows Form Designer
    'It can be modified using the Windows Form Designer.
    'Do not modify it using the code editor.
    Friend WithEvents Button1 As System.Windows.Forms.Button
    <System.Diagnostics.DebuggerStepThrough()> _
    Private Sub InitializeComponent()
      Me.Button1 = New System.Windows.Forms.Button
      Me.SuspendLayout()
      '
      'Button1
      '
      Me.Button1.Location = New System.Drawing.Point(96, 88)
      Me.Button1.Name = "Button1"
      Me.Button1.TabIndex = 0
      Me.Button1.Text = "Button1"
      '
      'Form1
      '
      Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
      Me.ClientSize = New System.Drawing.Size(292, 273)
      Me.Controls.Add(Me.Button1)
      Me.Name = "Form1"
      Me.Text = "Form1"
      Me.ResumeLayout(False)
    End Sub

     

     

    2009年1月16日 2:21

所有回覆

  • Hi Thakurabhi,

    If you want to display the codes of form properties, may be you can try the following.
    On the "Solution Explorer"
    Click on the "Show All Files" Button
    Which is between the "Properties" and "Refresh" button.

    Once you have clicked that.
    The Solution Explorer should display a lot of files/folder.

    You would need to click on the "+" sign on the form that you want to view the "Codes of the form properties" to expand the files. Then you will see there has a file called "Your Form Name".Designer.vb. Once you double click on that file. It should show you the code of the form's properties.

    Hope this can help.

    2009年1月15日 8:45
  • If you are going to look on the Form's properties code, you have to do another way.

     

    In VS.NET 2002/2003, right click the Form1.vb and select "View code" in the solution explorer. In the Code View, you will see a grey text "Windows Form Designer generated code" and these word are surround by a square. You can expand the designer code region by clicking the plus [+] symbol next to the region name.

     

    Inside the region, you will find a few key elements:

    • A constructor for the form (a Sub New() )

    • A Dispose procedure

    • Declarations of all of the controls on the form

    • A sub called InitializeComponent

    You will see something like this

    Code Snippet

    'NOTE: The following procedure is required by the Windows Form Designer
    'It can be modified using the Windows Form Designer.
    'Do not modify it using the code editor.
    Friend WithEvents Button1 As System.Windows.Forms.Button
    <System.Diagnostics.DebuggerStepThrough()> _
    Private Sub InitializeComponent()
      Me.Button1 = New System.Windows.Forms.Button
      Me.SuspendLayout()
      '
      'Button1
      '
      Me.Button1.Location = New System.Drawing.Point(96, 88)
      Me.Button1.Name = "Button1"
      Me.Button1.TabIndex = 0
      Me.Button1.Text = "Button1"
      '
      'Form1
      '
      Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
      Me.ClientSize = New System.Drawing.Size(292, 273)
      Me.Controls.Add(Me.Button1)
      Me.Name = "Form1"
      Me.Text = "Form1"
      Me.ResumeLayout(False)
    End Sub

     

     

    2009年1月16日 2:21