www.ndwl.net > VB编程题目

VB编程题目

'略微有些难度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 "...

第一题: 运行条件: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 ...

我能说看不清楚么? Private Sub Command1_Click()a = Val(Text1) '文本框里的值取出来b = Val(Text2) '分别存到三个变量里,做方程的系数c = Val(Text3)If a 0 Then '首先判断第一个系数不为0 的情况 dt = b ^ 2 - 4 * a * c '公式中用到的表达...

Private Sub Form_Click() Dim i As Long, A As Long A = 0 For i = 1 To 200 If i Mod 5 = 0 And i Mod 7 = 0 Then Print i A = A + i End If Next Print "以上是同时被5和7整除的数,和=" & A End Sub

Private Sub Command2_Click()Text1.Text = Val(Text3.Text) / Val(Text2.Text)End SubPrivate Sub Command1_Click()Text3.Text = Val(Text1.Text) * Val(Text2.Text)End SubPrivate Sub Command3_Click()Text3.Text = ""Text1.Text = ""Text2.T...

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...

定义变量及数组 录入 求出平均值 循环各数组元素,条件满足

dim是动态变量 每次重新开辟空间,不保留原有的值。 static是静态变量, 保留原有的数据。因此第一次单击按钮时 a=a+5 a=5 b=b+5 b=5 单击事件结束后 a释放空间。b不释放空间,保留其值5 第二次单击时 a重新开辟空间 a=a+5 a=5 , b=b+5 b=10

Private Sub Form_Click() Dim n As Integer, i As Integer, j As Integer, s As Double, s1 As Double n = InputBox("请输入n", "输入") For i = 1 To n s1 = 1 For j = 2 To i s1 = s1 * j Next j s1 = i / s1 If i Mod 2 = 0 Then s1 = -s1 s...

Private Sub Command1_Click() Text4.Text = Mid(Text1.Text, Val(Text2.Text), Val(Text3.Text) - Val(Text2.Text) + 1)End SubPrivate Sub Command2_Click() Text1.Text = "" Text2.Text = "" Text3.Text = "" Text4.Text = ""End Sub

网站地图

All rights reserved Powered by www.ndwl.net

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