VB.net learning notes (2) VB.net Interface

Source: Internet
Author: User

1. solution, project, assembly, and namespace

I'm so angry. Someone wrote it clearly that Baidu is a good teacher.

Beginners can easily confuse these concepts. Let's talk about projects first. In general, a project can be a software you develop.

In. Net, a project can be displayed in multiple types, such as console applications, Windows applications, class libraries ),

Web applications, Web Services, and Windows controls. After compilation and translation, the application will be compiled into the. exe file,

The rest will be compiled into. DLL files. Both the. exe file indicates that it can be executed, as shown in the program. These applications have a main program entry point,

That is, the main () method (). Class Libraries and Windows controls do not have this entry point, so they cannot be directly executed. Instead, they only provide some functions for other projects to call.

In Visual Studio. NET, you can select "new" and "project" from the "file" menu to create a new project. For example, create a console application.

Note that in addition to creating a console project, Visual Studio also provides a solution ).

What is the purpose of this solution?

If you only need to develop a hello World project, the solution will naturally be useless. However, a slightly more complex software requires many modules,

To reflect the hierarchical relationship between each other and facilitate the reuse of programs, multiple projects are often required. Each project implements different functions. Finally, these project teams are combined,

A complete solution is formed. In an image, the solution is a container, which is divided into multiple layers and multiple cells to store different projects.

The relationship between a solution and a project is greater than or equal. After the solution is created, a file with the. sln extension will be created.

Add a project to the solution. You cannot use the "new" method. Instead, select "add Project" in the "file" menu ". The added project can be a new project,

It can also be an existing project.

Assembly is called assembly. I don't want to mention the academic concept. In general, a project is also an assembly. From the design perspective,

It can also be regarded as a complete module or a package ). Therefore, an assembly can also be reflected as a DLL file,

Or EXE file. There are many articles about how to divide an assembly, but beginners do not need to consider it for the moment.

The namespace is commonly used as follows:

The system root namespace provides functions used by all applications, such as types, recyclers, attributes, and exceptions.

System. Data implements the ADO. net function for data access

System. Drawing provides the GDI + Function

System. windwos. Forms provides the function of creating a form application.

System. XML processing XML class

In the reference folder:

2. Outline display (hierarchical display) and smart sensing

Outline display (some are translated as hierarchical display, so you have to check it for a long time. Only this one). You can fold the display code to make your vision more fresh.

Smart sensing is beneficial to people we are not commonly used.

In addition to system-defined outline display, the outline can also be manually defined.

# Region "this is the area fold I defined"

............................ Foldable code

# End Region

3. Assembly assemblyinfo. VB

This is the property of the Assembly. Some product identifiers and version control are not set by code, but are embodied in this after attribute settings.

4. Form file (form1.designer. VB)

In VB6, the Form file suffix is frm and cannot be opened in text. VB.net can be opened:

After opening the file, it is as follows:

<Global. Microsoft. VisualBasic. compilerservices. designergenerated ()> _ partial class form1 inherits system. Windows. Forms. Form 'form rewrite dispose to clear the component list. <System. diagnostics. debuggernonusercode ()> _ protected overrides sub dispose (byval disposing as Boolean) Try if disposing andalso components isnot nothing then components. dispose () end if finally mybase. dispose (disposing) end try end sub 'private components as system required by the Windows Form Designer. componentmodel. icontainer 'note: The following process is required by the Windows Forms designer. 'You can use the Windows Forms designer to modify it. 'Do not use the code editor to modify it. <System. diagnostics. debuggerstepthrough ()> _ private sub initializecomponent () me. textbox1 = new system. windows. forms. textbox () me. button1 = new system. windows. forms. button () me. suspendlayout () ''textbox1' me. textbox1.location = new system. drawing. point (21, 16) me. textbox1.name = "textbox1" me. textbox1.size = new system. drawing. size (99, 21) me. textbox1.tabindex = 0 '''button1' me. button1.locati On = new system. drawing. point (144, 16) me. button1.name = "button1" me. button1.size = new system. drawing. size (75, 23) me. button1.tabindex = 1 me. button1.text = "button1" me. button1.usevisualstylebackcolor = true ''form1 ''me. autoscaledimensions = new system. drawing. sizef (6.0 !, 12.0 !) Me. autoscalemode = system. windows. forms. autoscalemode. font me. clientsize = new system. drawing. size (244,149) me. controls. add (Me. button1) me. controls. add (Me. textbox1) me. name = "form1" me. TEXT = "form1" me. resumelayout (false) me. extends mlayout () end sub friend withevents textbox1 as system. windows. forms. textbox friend withevents button1 as system. windows. forms. buttonend class

The first part is to overwrite and release resources.

Part 2 component Initialization

Add a new control first

Then set the initial values (textbox1, button1) respectively)

Add to the control set

Note: To improve efficiency, use suspendlayout () to pause the layout. After all settings are complete, resumelayout () to restore the layout,

The third part (the last two sentences) specifies the event in response to the corresponding control

5. debug and release versions

In the Visual Studio 2012 project, different configurations are used for the release and debugging versions of the program.

As the name suggests, the purpose of generating a debug version is for debugging, and the purpose of generating a release version is for final distribution of the version.

If you use Visual Studio to create a program, Visual Studio automatically creates these configurations and sets the appropriate default options and other settings. Under the default settings:
The "debug" configuration of the program is compiled with all the debugging information, without optimization. Optimization can complicate debugging because the relationship between source code and generated commands is more complex.
The program's "publish" configuration is fully optimized and does not contain any symbolic debugging information. Based on the compiler options used, you can generate debugging information in the [obsolete] program database file (C ++.

If you must debug the release version later, it is very useful to create a PDB file.

You can use the "standard" toolbar or the Configuration Manager to switch between the release and DEBUG Versions.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.