VB Prodigy Course (cont.)--Design system interface and Object properties

Source: Internet
Author: User
Tags modify

This article welcomes the non-commercial use of reprint, but need to indicate from the "Programming Network" and the corresponding URL link.

This system is a very simple example of database operation, can add to the database, modify and delete records of these basic operations. The system uses the data display control MSHFlexGrid the records in the database, uses the data link control adodc the linked database as the MSHFlexGrid data source, uses the text box to receive the data which the system runtime user enters.

The steps are as follows:

First, start VB6, create a new Standard EXE project, and the project Form1 Caption property set to "Programming Portal Web Site Management System", the Width property value set to 7950,height property value set to 4620.

Second, add a adodc control to the form. If the ADODC control is not found in the Toolbox, you can right-click the Toolbox, select the Part ... menu item, and then select Microsoft ADO Data Control6.0 (OLE DB) in the Controls tab of the Parts window.

In the VB Properties window we edit the three property values of the ADODC control, with the rest of the property values using the default:

1, ConnectionString property value set to: Provider=Microsoft.Jet.OLEDB.4.0;Data Source=e:\vb\access_db.mdb; Persist Security Info=false

This property sets the connection Access_db.mdb this database.

2. The Recordsourc property value is set to: SELECT * from Wzdz

The function of the SQL statement in this attribute value is to query out all the records in the Wzdz table.

3, the Visible property value is set to False to make it invisible at run time.

Add a MSHFlexGrid control to the form, if there is no MSHFlexGrid control in the Toolbox, right-click the Toolbox, select the "part ..." menu item, and then select the Microsoft hierarchical in the Controls tab of the Parts window FlexGrid Control 6.0 ". Then in the VB Properties window, the name of the MSHFlexGrid control is modified to MS1, as shown in the following figure:

The MSHFlexGrid control is then set as follows:

1, DataSource property: In the VB Properties window to set its value to ADODC1, that is, use the ADODC control as its data source.

2, backcolorbkg properties: In the VB Properties window to set its value to &h00ffe0e0&, this is the setting of the MSHFlexGrid control background.

3, Backcolorfixed property: In the VB Properties window to set its value to &h00c0ffff&, which is the background of the displayed caption of the set MSHFlexGrid control.

4, Width property: In the VB Properties window to set its value to 7695.

5, Height property: In the VB Properties window to set its value to 2175.

6. Right-click the MSHFlexGrid control, select "Properties" in the pop-up menu, modify behavior 4 in the "General" tab of the Pop-up "Property Pages" dialog box, modify column 4, modify fixed behavior 0, modify fixed column 0. If the data link is normal, you can see that the column headings and column names are already set on the band tab of the Property Pages dialog box, and note that you should check the column headers option on the Band tab, otherwise the column headers cannot be displayed at run time, as shown in the following illustration. The other parts of the Property Pages dialog box use the default values.

Add 4 Label controls (labels) to the form and set the following properties for them in the VB Properties window:

1, Caption property: Set to the website name, website address, website description and number respectively.

2, Alignment property: All set to "2-center".

3, AutoSize property: All set to true.

Five, add 4 TextBox controls (text boxes) to the form, and adjust their position in a row to correspond with 4 labels, namely: Website name →TEXT1, website address →text2, website description →text3, number →TEXT4.

Six, add 4 CommandButton controls (command buttons) to the form, set their caption properties to add records, modify records, delete records, and exit system, and adjust their positions in a row, below the text box.

Seven, in the middle of two rows of text boxes and command buttons, add a line control, appropriately drag the control points at both ends to adjust the length to the appropriate, and its BorderColor property to &h00c00000&, the role is to separate the text box and command button, It seems to look better visually.

After all the controls have been set up, the interface is shown in the following illustration:

The next step is to add the event code to the object.

See a full set of "VB Prodigy Tutorials" (continued)

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.