[C # entry] The first C # windows program

Source: Internet
Author: User

Tool: vs2008

 

Step 1:

Open vs, file-New-project;

At this time, if you selected C ++ or other non-C # projects when vs was started for the first time, you can select

"Other languages"-Visual C #-Windows form applicationsProgram

To create a C # project.

In this case, a form1 appears in the workspace, which is very similar to VB.

Step 2:

Open the Toolbox (which can be found on the right side of the workspace) or open it through view-> toolbox.

Step 3:

Place some components on from1, such as a label and a button.

Select the component on form1, right-click the "-" attribute, and you can see: (such as label1)

You can set the default display of the label in the text attribute. The name attribute sets the name of the label (used for calling ). For example, change the text attribute to null and the name attribute to tips.

After the text is set to null, the label will not be visible on form1.

To select it.

Step 4:

Add action.

Double-click button1 to enter the code area.

The button#click (Object sender, eventargs e) function is called when the button is clicked.

Let's assume this action: click the button and "hello, it's elar." is displayed in the label section .".

At this point, you can press F7 to compile the project. The advantage of doing so is that vs can check the newly added components during coding.

For example, the tips component can prompt itself.

AddCodeAs follows:

Last step:

Press F5 or Ctrl + F5, or the small green triangle "start debugging" on the interface. Let's take a look at our hello World.

--------------------------------------------

Tutorial complete ^_^

Related Article

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.