tailieunhanh - Using Controls Database to the Form Windows
Adding Controls to the Form So far you have created a form, set some of its properties, and examined the code that Visual Studio 2005 generates. | Adding Controls to the Form So far you have created a form set some of its properties and examined the code that Visual Studio 2005 generates. To make the form useful you need to add controls and write some code of your own. The Windows Forms library contains a varied collection of controls. The purposes of some are fairly obvious for example TextBox ListBox CheckBox and ComboBox whereas other more powerful controls such as the DateTimePicker might not be so familiar. Using Windows Forms Controls In the next exercise you will add controls to the form that allow a user to input member details. You will use a variety of different controls each suited to a particular type of data entry. You will use TextBox controls for entering the first name and last name of the member. Each member belongs to a tower where bells hang . The Middleshire district has several towers but the list is static new towers are not built very often and hopefully old towers do not to fall down with any great frequency. The ideal control for handling this type of data is a ComboBox. The form also records whether the member is the tower captain the person in charge of the tower who conducts the other ringers . A CheckBox is the best sort of control for this it can either be selected True or cleared False . TIP CheckBox controls can actually have three states if the ThreeState property is set to True. The states are True False and Indeterminate. These states are useful if you are displaying information that has been retrieved from a relational database. Some columns in a table in a database allow null values indicating that the value held is not defined or is unknown. If you want to display this data in a CheckBox you can use the Indeterminate state to handle null values. The application also gathers statistical information about when members joined the association and how much bell ringing experience they have up to one year between one and four years between five and nine years and ten or more .
đang nạp các trang xem trước