Logo

Navigation
  • Home
  • Services
    • ERP Solutions
    • Implementation Solutions
    • Support and Maintenance Solutions
    • Custom Solutions
    • Upgrade Solutions
    • Training and Mentoring
    • Web Solutions
    • Production Support
    • Architecture Designing
    • Independent Validation and Testing Services
    • Infrastructure Management
  • Expertise
    • Microsoft Development Expertise
    • Mobile Development
    • SQL Server Database and BI
    • SAP BI, SAP Hana, SAP BO
    • Oracle and BI
    • Oracle RAC
  • Technical Training
    • Learn Data Management
      • Business Intelligence
      • Data Mining
      • Data Modeling
      • Data Warehousing
      • Disaster Recovery
    • Learn Concepts
      • Application Development
      • Client Server
      • Cloud Computing Tutorials
      • Cluster Computing
      • CRM Tutorial
      • EDI Tutorials
      • ERP Tutorials
      • NLP
      • OOPS
      • Concepts
      • SOA Tutorial
      • Supply Chain
      • Technology Trends
      • UML
      • Virtualization
      • Web 2.0
    • Learn Java
      • JavaScript Tutorial
      • JSP Tutorials
      • J2EE
    • Learn Microsoft
      • MSAS
      • ASP.NET
      • ASP.NET 2.0
      • C Sharp
      • MS Project Training
      • Silverlight
      • SQL Server 2005
      • VB.NET 2005
    • Learn Networking
      • Networking
      • Wireless
    • Learn Oracle
      • Oracle 10g
      • PL/SQL
      • Oracle 11g Tutorials
      • Oracle 9i
      • Oracle Apps
    • Learn Programming
      • Ajax Tutorial
      • C Language
      • C++ Tutorials
      • CSS Tutorial
      • CSS3 Tutorial
      • JavaScript Tutorial
      • jQuery Tutorial
      • MainFrame
      • PHP Tutorial
      • VBScript Tutorial
      • XML Tutorial
    • Learn Software Testing
      • Software Testing Types
      • SQA
      • Testing
  • Career Training
    • Career Improvement
      • Career Articles
      • Certification Articles
      • Conflict Management
      • Core Skills
      • Decision Making
      • Entrepreneurship
      • Goal Setting
      • Life Skills
      • Performance Development
      • Personal Excellence
      • Personality Development
      • Problem Solving
      • Relationship Management
      • Self Confidence
      • Self Supervision
      • Social Networking
      • Strategic Planning
      • Time Management
    • Education Help
      • Career Tracks
      • Essay Writing
      • Internship Tips
      • Online Education
      • Scholarships
      • Student Loans
    • Managerial Skills
      • Business Communication
      • Business Networking
      • Facilitator Skills
      • Managing Change
      • Marketing Management
      • Meeting Management
      • Process Management
      • Project Management
      • Project Management Life Cycle
      • Project Management Process
      • Project Risk Management
      • Relationship Management
      • Task Management
      • Team Building
      • Virtual Team Management
    • Essential Life Skills
      • Anger Management
      • Anxiety Management
      • Attitude Development
      • Coaching and Mentoring
      • Emotional Intelligence
      • Stress Management
      • Positive Thinking
    • Communication Skills
      • Conversation Skills
      • Cross Culture Competence
      • English Vocabulary
      • Listening Skills
      • Public Speaking Skills
      • Questioning Skills
    • Soft Skills
      • Assertive Skills
      • Influence Skills
      • Leadership Skills
      • Memory Skills
      • People Skills
      • Presentation Skills
    • Finding a Job
      • Etiquette Tips
      • Group Discussions
      • HR Interviews
      • Interview Notes
      • Job Search Tips
      • Resume Tips
      • Sample Resumes
 

Exploring the Forms Designer generated code

By Exforsys | on June 7, 2005 |
VB.NET 2005

VB.NET 2005 Free Training

Exploring the Forms Designer generated code

As you create a new project in the Visual Basic, the IDE generally automatically adds lots of lines of code on its own. Visual Basic 2005 comes with an option to skip over this behavior of the Visual Basic IDE. The default option comes with this behavior enabled.

These codes are introduced with an aim that the user can continue to use the form without bothering about write codes to instantiate the form with a function new() and also the code includes the declaration and instantiation of all the controls that have been dragged and dropped on to the form. As a developer you may need to add controls like text boxes, grid controls, database controls and also need to bind data to some control at design time.

Much of these activities can be done at design time and visually without adding any line of code. The Visual Basic IDE is equipped with inbuilt facility that generates codes for these features. The more interesting part is not just that. You can actually add functionality to the form by adding codes to these functions like new() which is the first function to be executed and can be used to perform additional tasks at the start time of the application or even before the form load takes place.

This code is stored in a new file Form1.Designer.vb. Let us take a closer look at this now. These codes that we are going to see have been taken from one of the demos of this tutorial.

<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated() > _

Partial Public Class Form1

    Inherits System.Windows.Forms.Form

    ‘Form overrides dispose to clean up the component list.

    <System.Diagnostics.DebuggerNonUserCode()> _

    Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)

        If disposing AndAlso components IsNot Nothing Then

            components.Dispose()

        End If

        MyBase.Dispose(disposing)

    End Sub 

    ‘Required by the Windows Form Designer

    Private components As System.ComponentModel.IContainer 

    ‘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.

    <System.Diagnostics.DebuggerStepThrough()> _

    Private Sub InitializeComponent()

        Me.Button1 = New System.Windows.Forms.Button

        Me.Button2 = New System.Windows.Forms.Button

        Me.Button3 = New System.Windows.Forms.Button

        Me.Button4 = New System.Windows.Forms.Button

        Me.Button5 = New System.Windows.Forms.Button

        Me.Button6 = New System.Windows.Forms.Button

        Me.Button7 = New System.Windows.Forms.Button

        Me.SuspendLayout()

        ‘Button1

        Me.Button1.Location = New System.Drawing.Point(13, 238)

        Me.Button1.Name = "Button1"

        Me.Button1.Size = New System.Drawing.Size(75, 23)

        Me.Button1.TabIndex = 0

        Me.Button1.Text = "Line"

        ‘Button2

        Me.Button2.Location = New System.Drawing.Point(98, 238)

        Me.Button2.Name = "Button2"

        Me.Button2.Size = New System.Drawing.Size(75, 23)

        Me.Button2.TabIndex = 1

        Me.Button2.Text = "Ellipse"

         ‘Form1

        ‘

        Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)

        Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font

        Me.ClientSize = New System.Drawing.Size(612, 273)

        Me.Controls.Add(Me.Button2)

        Me.Controls.Add(Me.Button1)

        Me.Name = "Form1"

        Me.Text = "Painting Shapes and Fill Objects"

        Me.ResumeLayout(False) 

    End Sub

    Friend WithEvents Button1 As System.Windows.Forms.Button

    Friend WithEvents Button2 As System.Windows.Forms.Button     

End Class

Definitions

InitializeComponent: This method helps to persist the property values that you have set in the Designer.

Public Sub New():The class constructor. You can put include some code that you want at the start up. However the best location for this code is the forms Load event.

Security in Windows Form:

The .NET Framework provides a superior security features in the application by introducing new features. The code access security allows you to permit varied degrees or trust to the code depending on where the code originates and also other factors that define the identity of the code. Security permissions are implemented to ensure security. Code can request the permissions it needs.

The .NET Framework security system determines whether such requests are honored. Requests are honored after verifying the code’s evidence and only relevant requests are granted those permissions. The permission given to the code never exceeds the current security settings. However, code will be granted less permission based upon a request.

The identity of the code forms the basis for granting the runtime permissions, also the level of trust the code is granted is determined by the security policy.

Code can demand that its callers have specific permissions. If you place a demand for certain permission on your code, all code that uses your code must have that permission to run.

There are three kinds of permissions, each with a specific purpose

Code access permissions, which represent access to a protected resource or the ability to perform a protected operation.

Identity permissions, which indicate that code has credentials that support a particular kind of identity.

Role-based security permissions, which provide a mechanism for discovering whether a user has a particular identity or is a member of a specified role. Thus a very robust and well managed security is provided in the .NET Framework.

« « Visual Studio Windows Forms Designer
5 Steps to a Great Cover Letter » »

Author Description

Avatar

Editorial Team at Exforsys is a team of IT Consulting and Training team led by Chandra Vennapoosa.

Free Training

RSSSubscribe 394 Followers
  • Popular
  • Recent
  • The .NET Framework Architecture Part 1

    May 27, 2005 - 0 Comment
  • The File Types Editor

    August 9, 2005 - 0 Comment
  • Building Graphical Interface elements

    June 11, 2005 - 0 Comment
  • SQL Server Stored Procedures

    July 11, 2005 - 0 Comment
  • Web Application Testing in VB.NET 2005

    July 28, 2005 - 0 Comment
  • The .NET Framework Architecture Part 2

    May 30, 2005 - 0 Comment
  • VB.NET Windows Application Testing

    August 9, 2005 - 0 Comment
  • Visual Studio Adding Controls to Windows Form

    June 20, 2005 - 0 Comment
  • Working with File System in .NET

    July 11, 2005 - 0 Comment
  • Web Application Tracing and Debugging

    July 30, 2005 - 0 Comment
  • Microsoft .NET Creating Installation Components

    August 10, 2005 - 0 Comment
  • Shared Assembly

    August 9, 2005 - 0 Comment
  • The File Types Editor

    August 9, 2005 - 0 Comment
  • Tracing VB.NET Windows Application

    August 9, 2005 - 0 Comment
  • VB.NET Windows Application Testing

    August 9, 2005 - 0 Comment
  • The Registry Editor in Visual Studio.NET 2005

    August 4, 2005 - 0 Comment
  • Customizing Setup Project in Visual Studio.NET 2005

    August 4, 2005 - 0 Comment
  • Deploying Windows Applications In Visual Studio.NET 2005

    August 3, 2005 - 0 Comment
  • Debugging Windows Applications In Visual Studio.NET 2005

    August 3, 2005 - 0 Comment
  • Working with Legacy Code and COM Components

    July 30, 2005 - 0 Comment

Exforsys e-Newsletter

ebook
 

Related Articles

  • Microsoft .NET Creating Installation Components
  • Shared Assembly
  • The File Types Editor
  • Tracing VB.NET Windows Application
  • VB.NET Windows Application Testing

Latest Articles

  • Project Management Techniques
  • Product Development Best Practices
  • Importance of Quality Data Management
  • How to Maximize Quality Assurance
  • Utilizing Effective Quality Assurance Strategies
  • Sitemap
  • Privacy Policy
  • DMCA
  • Trademark Information
  • Contact Us
© 2023. All Rights Reserved.IT Training and Consulting
This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish.AcceptReject Read More
Privacy & Cookies Policy

Privacy Overview

This website uses cookies to improve your experience while you navigate through the website. Out of these, the cookies that are categorized as necessary are stored on your browser as they are essential for the working of basic functionalities of the website. We also use third-party cookies that help us analyze and understand how you use this website. These cookies will be stored in your browser only with your consent. You also have the option to opt-out of these cookies. But opting out of some of these cookies may affect your browsing experience.
Necessary
Always Enabled
Necessary cookies are absolutely essential for the website to function properly. This category only includes cookies that ensures basic functionalities and security features of the website. These cookies do not store any personal information.
Non-necessary
Any cookies that may not be particularly necessary for the website to function and is used specifically to collect user personal data via analytics, ads, other embedded contents are termed as non-necessary cookies. It is mandatory to procure user consent prior to running these cookies on your website.
SAVE & ACCEPT