www.ndwl.net > VB编程题目

VB编程题目

' 单击窗体函数里面的代码: Dim i As Integer ' 从1~200 Dim count As Integer ' 保存所求的和 For i=1 to 200 If (i Mod 5 = 0) And (i Mod 7 = 0) Then count = count + i End If Next i

判断素数的原理是: 素数是只能被1和本身整除的数。例如 3只能被1和3整除,17只能被1和17整除等等,想9就不是素数(能被1,3,9整除)。 编程的算法是: 穷举法,就是将需要判断的数除2、除3....一直除到这个数减1. 例如:判断7是不是素数的算法...

'略微有些难度Private Sub command1_click()Dim X As StringDim brrDim a As LongDim b As LongX = InputBox("请输入2个整数(以英文逗号分隔):", "交换变量", "例如:3,344", 1000, 1000)brr = Split(X, ",") If UBound(brr) > 1 ThenMsgBox "...

在vb中true的值为-1,false的值为0, 也就是说如果a=0成立,则a=0的值为true, 把true用于算数运算时它是-1 如果四个逻辑表达式中,有三个为真,则它们的和为-3

选( A ) x=0 x+1=1 Dim x%是用类型说明符声明变量的方式 %是integer的类型说明符 是dim x as integer 的简化写法 x初始化时未赋值情况下默认是0 所以x=0 msgbox(x+1)=1 常用类型说明符 % integer & long ! single # Double $ string @ currency

Private Sub Command1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single) Command1.MousePointer = vbCross End Sub Private Sub Command1_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single) I...

Private Sub Command1_Click() If Len(Text1) >= 2 Then Text1 = Left(Text1, 2) End If End Sub Private Sub Command2_Click() Text1 = "" End Sub Private Sub Form_Load() Label1.Caption = "新字符串" Command1.Caption = "左边2个字符" Co...

Private Sub Form_Load()Text1.FontSize = 10End SubPrivate Sub command1_click()Text1.FontSize = 10 + Int(Rnd * 3 + 1)End SubPrivate Sub command2_click()Text1.FontSize = 10 - Int(Rnd * 3 + 1)End SubPrivate Sub command3_click()Text...

第一题: 运行条件:form1上面有3个控件,文本框text1,内容代表n,文本框text2,内容代表x,按钮command1,执行计算 Option Explicit Private Sub Command1_Click() MsgBox cal(Me.Text1, Me.Text2) End Sub Function cal(ByVal n As Integer, ByVal x ...

对楼上的一些该进 VB的文本框有个属性 MaxLength 也就是最大输入个数,你将它设置为8,输入的字符最大个数就是8了,用不着进行判断

网站地图

All rights reserved Powered by www.ndwl.net

copyright ©right 2010-2021。
www.ndwl.net内容来自网络,如有侵犯请联系客服。zhit325@qq.com