因为涉及窗体布局问题,直接叙述不方便,所以直接给你frm文件。把下面的代码保存为后缀名为.frm的文件,再用vb打开。=====================version 5.00begin vb.form form1 caption = "form1" clientheight = 3195 clientleft = 60 clienttop = 345 clientwidth = 4680 linktopic = "form1" scaleheight = 3195 scalewidth = 4680 startupposition = 3 '窗口缺省 begin vb.commandbutton command3 caption = "素数" height = 375 left = 2400 tabindex = 5 top = 600 width = 975 end begin vb.hscrollbar hscroll1 height = 375 left = 360 max = 10000 tabindex = 3 top = 1920 width = 3615 end begin vb.commandbutton command2 caption = "结束" height = 615 left = 960 tabindex = 2 top = 1080 width = 855 end begin vb.textbox text1 height = 375 left = 2760 locked = -1 'true tabindex = 1 text = "text1" top = 1440 width = 975 end begin vb.commandbutton command1 caption = "总计" height = 615 left = 3000 tabindex = 0 top = 2400 width = 1335 end begin vb.label label1 caption = "label1" height = 375 left = 720 tabindex = 4 top = 600 width = 1335 endendattribute vb_name = "form1"attribute vb_globalnamespace = falseattribute vb_creatable = falseattribute vb_predeclaredid = trueattribute vb_exposed = falseoption explicitfunction **prime(byval n as long) as booleandim i as longfor i = 2 to int(n / 2) if n mod i = 0 then **prime = false: exit functionnext**prime = trueend functionsub sum(x as integer)dim i as integer, s as longfor i = 1 to xs = s + inexttext1.text = send subprivate sub command1_click()sum (hscroll1.value)end subprivate sub command2_click()endend subprivate sub command3_click()dim i as integer, j as integerfor i = 2 to hscroll1.valueif **prime(i) thenprint i,j = j + 1if j mod 5 = 0 then printend ifnextend subprivate sub hscroll1_change()label1.caption = hscroll1.valueend sub 20210311
vb写邮编查询系统超简单啊,连数据库都可以不用,一个文本文件就够了。先准备一个文本文件 postcode.txt 内容如下100084,北京,海淀区,清华大学100086,北京,海淀区,学院路010010,**呼和浩特市,新城区,**……vb代码如下private sub from_load() form1.show:form1.autoredraw = true dim pc as stri...
代码如2113下: dim a!b!c!s!p!a=inputbox("请输5261入第一条边长4102") b=inputbox("请输入第二条边长") c=inputbox("请输入第三条边长") if a+b print"这样的三角形不存在 else p=(a+b+c)/2 s=sqr(p*(p-a)*(p-b)*(p-c)) print"这个三角形的1653面积是;s end if 扩展资...
12345678910111213141516171819202122#!usr/bin/python#-*-coding:utf-8-*-#file:sum_number.py"""求和"""def sumner(n):if **instance(n,int):m=n+1 sum_num=0 for i in range(1,m):sum_num+1.0/(i*(i+1))*(pow(-1,i)...
private sub button7_click(byval sender as system.object,byval e as system.eventargs)handles button7.click dim str as string=" str=inputbox("请输入要反转的数字") dim pl as string=strreverse(str) textbox6.text=v...
private sub command1_click()dim m as single,r as single,h as singlem=val(text1.text) '美元数量h=8.099 '汇率r=m*h '换算label1.caption=format (r, "#.##") '显示兑换的人民币数量end sub