Developing a database application system using C #

Source: Internet
Author: User

Chapter One first knowledge of Windows program 01. Talking about the application of the console

Parsing: Console application: Display in DOS window

Windows Forms applications: A program that has controls in support of events

02. Notes about the form item:

/*01. A solution can contain multiple projects,

* Multiple forms can be included under an item

* 02. How do I set a form under a project as the startup form???

* Parse: By changing the last line of code in the Program.csmain method setting

* 03. The Name property of the control is equivalent to the hidden value, it must be changed

* The Text property that really displays content on the form

* 04. If there are multiple projects under a solution, how do I set a project as a startup item??

* Resolution: You can right click on the item → Set as Startup item

* 05. How to save the project in the computer room, or how to open it after saving???

* Resolution: You can save the solution to the specified project, the next time

* Open the SLn file directly

*

* 06. Event excitation error problem???

(This is normal, and now the concept of everyone's events is not quite understood,

* As you learn in depth, you will understand)

* Parsing: Notice when events are fired

*

* 07. How can I change the size after the form is run?

* Resolution: The following settings:

* 01. Disable the Maximize button

* 02. Set the FormBorderStyle property to any property that starts with a fixed OK

*/

03: After creating a form in VS, all forms inherit from Form class 04. Constructor

Parsing: In a class, the method name is the same as the class name, and there is no method that returns a value type, called a constructor

Role: Do initialization work

05. What is the event of the event detailed

Analysis: A situation in which the state of another thing (a bird) is stimulated by an external thing (a shotgun).

The event looks like a parameter method with 2 parameters

Sender: Represents the source of the event: the person who fired the event

E: Event Parameters: Some information related to the event!

06. Form Color Change Exercise

Parse: Event (form's Click event)

This: current form object

This. backcolor=color.red;

07.MessageBox (definitely 2 points)

01. Parameter One: prompt information

Parameter two: Title text

Parameter three: Button settings

Parameter four: Icon setting

MessageBox.Show ("Congratulations, the jackpot is 500, will you please eat?" "," The Warm Hint ", messageboxbuttons.yesno,messageboxicon.warning);

Warning:

Information:

Error:

08. Form Passing Value

Parsing: Passing the login user name from the login form to the main form, you can define a public variable in the main form and then write the following code in the Login button event of the login form:

Main Frm=new main ();

Frm.name=txtname.text;

frm. Show ();

The label control is then assigned a value in the Load event of main.

09. Real Exit Procedure

In the FormClosing event of the form, write Application.exit ();

10. Multi-text box for null validation

01. Any control in the toolbox is a class, and once you drag him onto the form, he becomes an object, and you can assign values to each of her properties through the F4 shortcut key in the Properties window.

11. How do I resolve the issue that the form is closed, but the entire app does not exit?

Parsing: Using Application.exit () will show

12. Exercise Focus

01. Form Jumps

How to jump from form a to form B

02. Exit the entire application

03. Welcome to Welcome to the screen, cold rain

The 2nd chapter builds a well-laid Windows program

November 21, 2015 13:45:24

01. Login:

Select count (1) from student

Where studentname= and loginpwd=?;

02. Add a record to the student table.

03. Radio button

04. Check button

05. Menu bar (MenuStrip)

Shortcut keys

Mode one: Open (&f), disadvantage: You must first use ALT + characters, first navigate to a level menu, and then press F to navigate to the corresponding content

Way two: Shortcutkeys opens (ctrl+f). Pros: You can skip the Level 1 menu and call the desired window directly

and split lines

06.ToolStrip (Toolbar)

. The picture of all items in the entire control is the same size as the original picture, and you need to set Imagescalingsize:

32x32 (entire control)

02. Display image and Text options: set Displaystyle value to ImageAndText ( single Item)

03. Location of images and text: Textimagerelation settings Imagebeforetext (Single item)

07. Form Passing Value

01. Menu bar (MenuStrip)

To set the shortcut key mode:

Mode one: 1. Set the Text property of the menu item to (Open (&f)),

You must first press ALT + main Menu shortcut key to enter the corresponding main menu,

Then press f directly to open the subform.

Mode two: The Shorcartkeys property is set by the menu item.

To create the corresponding key combination, you can press the main interface directly into the corresponding

Letter keys to open subforms

The drawing of the dividing line:

01. Inserting a split line

02. Enter a minus sign (-)

02. Toolbars (ToolStrip)

01. Set the picture to the toolbar item, first the picture size is controlled by the whole ToolStrip,

Sets the imagescalingsize value to the pixel value of the picture itself.

02. Add the type of each item to DropDownButton

03. Set the Text property to display

04. Set the Displaystyle property to ImageAndText so that the picture and text are displayed simultaneously

The relative position of the 05.TextImageRelation image and the text

Application. Exit () and This.close ()

Application.exit ();//exit the entire application

This. Close ();//Closes the current form

04. Use of Common controls

RadioButton

Datetimerpicker

GroupBox

Panel

05. Reservation question: How to make Datetimepiker not display the week 06.Anchor and Dock properties

Anchor: The pixel value that keeps the position of the control and the edge of the form fixed.

Dock: Make a control dock to a part of the form (top,bottom,left,right), or fill the entire form (fill)

07. Setting up an MDI form

001. Set the IsMdiContainer property of the main form to True

002. Add the following code before the subform show ():

frm. Mdiparent=this;//this represents the current form

Object-oriented promotion: As long as the point can be set by the mouse properties of the place, can be implemented through code, but the code can not achieve all can be achieved through a mouse point!

08. The things about ReadOnly

If you set the ReadOnly property on a textbox, setting the font foreground color is not working, and you must set the BackColor to any of the colors outside the control.

09. How to bind data in a grade table in a database to a drop-down box

Parse: The interface on the Grade drop-down box shows the grade name, and the student table is the grade number, how to do??

Parsing: public int getidbyname (string gradename)

{

string sql= "Select Gradeid from grade where Gradename= '" +gradename+ "'";

}

3rd. Using the ListView control to display the data

01.ListView Preliminary

Step one: Pictures from ImageList, in ImageList:

\

Step Two: Associate the two properties of the ListView with the ImageList picture source

Step three: Add items to the ListView control

Step four: Set the icon type that the ListView displays

4th. Implementing data Update for Windows programs 01. Enumeration Type

001. Enumeration is a value type

002. Enumeration Essentially holds a number

003. cannot have a method in an enumeration

004. Enumeration is also a data type

005. enumerations are generally used only to define a finite number of values ( within ten)

02.Timer controls

Two main properties: Enabled: You can control whether the timer is on or off.

Start (): Turn on Timer stop () Stop timer

Interval: Executes a piece of code every few milliseconds.

Important event: TICK: The code you want to repeat executes is written to the Tick event.

03. Modal window and non-modal window

Modal window: If the window does not close, you cannot manipulate any other function in the program. ShowDialog ()

Immediate modification issues

The 5th chapter implements data binding for Windows programs 01. The Grade drop-down box is loaded in a new way. 02. Use the DataGridView control to display information for all learners 03. Use DataAdapter and DataSet objects to manipulate offline data. 04.Dataset: A temporary database exists in client memory.

A dataset is made up of multiple DataTable .

There can be more than one row in a DataTable , each row is a DataRow object, and each column is a DataColumn object.

5. "Please select" can be placed in the database to form a record.

Landing

Change Password

Main interface

New Student Information

Modify Student Information

Find student information by name

Performance management

Delete

Check student information by grade

DataAdapter and datasets in conjunction with diagrams

The 6th chapter data filtering and Sorting 01. TreeView Control

* Learned in a TreeView control, the type of each node is a TreeNode.

* The root node of TREEVUEW is automatically activated by default

* Get the currently selected node code: Tvlist.selectednode

* Gets the root node of the currently selected node: TvList.SelectedNode.Parent (Root node object)

* Counts the depth of a node in the TreeView control, starting at 0. The property that gets the depth is

LvList.SelectedNode.Level;

* How to add a picture in a node: ImageIndex (the picture is displayed by default) (selectedImageIndex: Selected picture)

*tag: A programming interface specifically designed for programmers to facilitate user action on the program. Tag can store any

Type of data, but no matter what type of data it was, once placed in the Tag property, it becomes

Object type, so a type conversion is performed when the Tag property value is removed.

*afterselect event, event triggered after a node is selected

02.DataView (Class)

DataView dv=new DataView ();

Dv. RowFilter ();

He said: I can meet you only with the DB interaction once, all subsequent query operations (filtering) are done by me.

What's *dataview doing?

Parsing: Used to filter the data of a table in a dataset dataset, in other words, to take out the student table

Part of the data that meets the criteria, and then saves it to the DataView object. DataView is just one of the client's saved data

container, and DataSet Ah, DataTable!

What does *dataset have to do with DataView and the DataTable?

Resolution: Here are 3 points.

The dataset contains multiple DataTable. A DataTable can have multiple DataView

* TheDataRow has a property called RowFilter, which can filter the data in the table.

Dv. Rowfilter= "Where is behind the content"; For example: DV. Rowfilter= "gradeid=" +gid+ "";

November 30, 2015 16:48:39

Homework:

1. In the inquiry student information Form according to the grade name, the following

The right-click menu has an item called Entry score

2.

3. Clear

4. After the student information is successfully added, the primary key value is returned.

Seventh Flight System (Thursday PM)

The eighth Chapter commodity management system

Developing a database application system using C #

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.