ImageVerifierCode 换一换
格式:DOC , 页数:10 ,大小:20.14KB ,
资源ID:2790648      下载积分:20 金币
快捷下载
登录下载
邮箱/手机:
温馨提示:
快捷下载时,用户名和密码都是您填写的邮箱或者手机号,方便查询和重复下载(系统自动生成)。 如填写123,账号就是123,密码也是123。
特别说明:
请自助下载,系统不会自动发送文件的哦; 如果您已付费,想二次下载,请登录后访问:我的下载记录
支付方式: 支付宝    微信支付   
验证码:   换一换

加入VIP,免费下载
 

温馨提示:由于个人手机设置不同,如果发现不能下载,请复制以下地址【https://www.docduoduo.com/d-2790648.html】到电脑端继续下载(重复下载不扣费)。

已注册用户请登录:
账号:
密码:
验证码:   换一换
  忘记密码?
三方登录: 微信登录   QQ登录   微博登录 

下载须知

1: 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。
2: 试题试卷类文档,如果标题没有明确说明有答案则都视为没有答案,请知晓。
3: 文件的所有权益归上传用户所有。
4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
5. 本站仅提供交流平台,并不能对任何下载内容负责。
6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

版权提示 | 免责声明

本文(一、编写简单的vb程序然后实现该程序(First, write a simple VB program and then implement the program).doc)为本站会员(dreamzhangning)主动上传,道客多多仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。 若此文所含内容侵犯了您的版权或隐私,请立即通知道客多多(发送邮件至docduoduo@163.com或直接QQ联系客服),我们立即给予删除!

一、编写简单的vb程序然后实现该程序(First, write a simple VB program and then implement the program).doc

1、一、编写简单的 vb程序然后实现该程序(First, write a simple VB program and then implement the program)Own collectionThink its usefulSo upload it to BaiduShare it with you!First, write a simple VB program and then implement the programCase 1-2. designed a simple calculator to complete the addition and subtraction func

2、tions, using the text box to do the data input and output. The interface after the program is shown as shown in the diagramPractice goal:(1) master the general process of writing a VB application(2) master the method of entering code form from object form(3) master the simple code writing method (th

3、e difficulty and emphasis of this topic)(4) understand the essential difference between tags and text boxes (labels can only be outputText boxes can be input and output(5) understand the shape of a label that can be set as a text boxThe text box can also be set to the shape of the tagThe attributes

4、used in this case: the Alignment attribute and the Caption property of Text; the method used: the Click method of Command(6) review the method of adding and resizing controls(7) understand the function of Val function and Str functionRequirement:1. click the Add buttonThe data in the text box 1 is a

5、dded to the data in box 2Results release text box 32. click the “subtract“ buttonThe data in the text box 1 is subtracted from the data in box 2Results release text box 33. click the screen“Clears the contents of the three text boxes4. click exit“End programThe operating procedure is as follows:The

6、first step: create a project (the same as case 1-1)The second step: build user interface(1) establish a new project (program): the same as case 1-1(2) the form editor appears to resize the form to the requested size(3) draw the control on the form according to the requirements of the topic:Draw thre

7、e “text boxes“Text1“, “Text2“ and “Text3“ are automatically marked in the box“;Draw three labels, tag automatically marked “Label1“, “Label3“, “Label3“Draw four “command buttons“Button “Command1“, “Command2“, “Command3“ and “Command4“ are automatically marked“(4) after finishing all the controlsAdju

8、st its position and size properlyThinking: in generalSimilar buttons should be the same sizeHow should it be realized?The third step: set the property of the control(1) there are only a few of the most commonly used attributes in VB programmingSuch as “name“, “Caption“, “Font“, “Text“, “ForeColor“ o

9、f the controlOther properties need not be setUse default values(2) to make the design interface clear and organizedUsually, the design information of form and control is made into a table before designAnd then design it by this tableThe interface design information table is:Object name (Name) header

10、 (Caption) text (Text)Windows Form1 VB programming exampleTab 1 Label1 data 1Tab 2 Label2 data 2Tab 3 Label3 calculation resultsText box 1 TxtData1 emptyText box 2 TxtData2 emptyText box 3 TxtRel emptyButton 1 cmdAdd add noButton 2 cmdSub subtraction noNo 3 cmdCls screen buttonNo 4 cmdEnd screen but

11、tonBe careful:(1) the name is the Name attributeAnd Caption are different attributesName is the internal name of the objectCaption is the external title of an object“(2) the name attribute is a read-only attributeThe name of the bid in the property window is the name“Name is used in the program(3) t

12、he Font property and ForeColor attribute of the control can be set according to the requirementsThe fourth step: write event driver code (not in case 1-1)1. into the program code window (there are 4 ways)* double-click the object to write the driver;* / execution view code window;* press the F7 key;

13、Click view code from project explorer“Introduction of program code window2. write the “add“ button driver(1) according to the requirements of the subjectClick the Add buttonThe addition operation is performedTherefore, in the code edit object box, select “cmdAdd“ (because the “add“ button Name attri

14、bute is cmdAdd), and because it is “click“So in the process / event box, select “Click“The system will automatically give the start and end rows of the driver(2) write the code between the start line and the end line:Text3.Text = Val (Text1.Text) + Val (Text2.Text)Object attribute values are represe

15、nted as object names. Attribute names such as: Text1.textModify attribute values of objects in codeBe careful:(1) the Val () in the above statement is a standard functionThe function is to convert character data into numeric data, and there is also a Str () function corresponding to itFunction is op

16、posite to Val () function. Please refer to MSDN for detailed function and usage(2) Text1.text is the content of the text box: the subtraction button driver programming method is the same as above3, the “screen“ button driver (clear out the contents of the text box)Private Sub cmdCls_Click ()Text1.Te

17、xt =“Text2.Text =“Text3.Text =“End SubNote: the sentence in the program should be indented to the right; the clear text box is nothing written in the text box;4, “end“ button driverPrivate Sub cmdExit_Click ()End End is the end statementFunction is the end of a program running;End SubThe fifth step:

18、 save the programThe project file is saved as: lx1-2.vbp, and the form file is saved as lx1-2.frmThe sixth step: operation engineeringClick the start button on the toolbarOr “run / start“ under the selection menu“The program starts runningThe initial interface is as follows:Enter the operation data

19、in the first text box and second text boxes, respectivelyClick “add“ or “subtract“ buttonThe calculation results appear in the third text boxes; click the “clear“ buttonThe data in the three text boxes is clearedReflection:1, after the above program runningWhen you input data, the data is on the lef

20、t side of the textboxHow can I make the data in the middle or right side of the text box?2, if you write the addition of the statement code Text3.Text = Val (Text1.Text) + Val (Text2.Text)Changed to: Text3.Text = Text1.Text + Text2.TextIs the running result correct? Why?3. Can you replace the text box of the calculation result with tags? What attribute can be used to change the shape of a tag to the shape of a text box?

本站链接:文库   一言   我酷   合作


客服QQ:2549714901微博号:道客多多官方知乎号:道客多多

经营许可证编号: 粤ICP备2021046453号世界地图

道客多多©版权所有2020-2025营业执照举报