Fourth. Implementing data Updates for Windows programs

Source: Internet
Author: User

The fourth chapter realizes the data update of Windows program. Enumeration 1. What is an enumeration?

A set of descriptive names.

2. Why use enumerations?

Let's say we're writing sex.

int gender = 0;//0 on behalf of male

= 1;//1 on behalf of women

= 2;

= 3;

How do I use enumerations?

public enum Gender

{

Male,fmale

}

Gender.male;

Gender.fmale;

public class Student

{

private int age;

public int Age

{

Get{return This.age;}

Set{this.age=value;}

}

private string name;

public string Name

{

Get{return THIS.name;}

Set{this.name = value;}

}

Private Gender Gender;//Field

Public Gender gender//Property

{

Get{return This.gender;}

Set{this.gender=value}

}

public void Show ()

{

string s = String.Empty ();

if (this. gender.tostring () = = "Male")

{

s = "male";

}

Else

{

s = "female";

}

Console.WriteLine (this. Age+ "--" + this. Name + "--" + s);

}

}

public static void Main (string[] args)

{

Student stu = new Student ();

Stu. Age = 10;

Stu. Name = "Xiao Qiang";

Use of enumerations

Stu. Gender = Gender.male;

}

Where do you use enumerations?

Sex, Grade

public enum Grade

{

S1,s2,y2

}

3. Timers Timer

When the WinForm form loads, the time is displayed.

A.enable:true

b.inteval:1000, how long is the first time

C.time1_tick (Object Obj,eventargs s)//How often to invoke the method

Be a child and turn the book.

1). ImageList

2). PictureBox take a picture from the ImageList

3). Use the timer to realize the effect of changing pictures

Fourth. Implementing data Updates for Windows programs

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.