www.ndwl.net > VB一个题目

VB一个题目

新建一个工程,先在Form1上放置控件 如图: 代码如下: Private Sub Command1_Click()Dim Si As Integer, pDay As StringSi = -1For i = 0 To Lst_cs.ListCount - 1If Lst_cs.Selected(i) = True ThenSi = iExit ForEnd IfNextIf Si = -1 ThenMs...

Private Sub Command1_Click()Dim a, b, c(5) As Integer, i As Integera = Array(1, 2, 3, 4, 5, 6)b = Array(9, 8, 7, 6, 5, 4)For i = 0 To 5 c(i) = a(i) + b(i) Print c(i); NextEnd Sub

窗体上加一个按钮,完整代码如下: Option Explicit Private Type Record MyName As String * 1 MyAve As Single End Type Private Sub Command1_Click() Dim d(20, 5) As Integer Dim x As Integer Dim i As Integer Dim j As Integer Dim EvrA...

1.用VB编程序设计一个简易的计算器 代码: Dim num_1, num2, flagPrivate Sub Command1_Click(Index As Integer) Select Case Index Case 0 To 9 Label1.Caption = Label1.Caption + CStr(Command1(Index).Caption) Case 10 Label1.Caption = La...

Private Sub Text1_KeyPress(KeyAscii As Integer)If Len(Text1.Text) > 15 ThenText2.Text = Text2.Text & Chr(KeyAscii)KeyAscii = 0Text2.SelStart = Len(Text2.Text)Text2.SetFocusEnd IfEnd Sub

Private Type utQuestion Description As String '问题描述 Option(2) As String '备选答案 Answer As Integer '正确答案的序号(0-2) End Type Dim Questions(19) As utQuestion, id As Integer, answer As Integer Private Sub Form_Load() D...

有关素数的定义:只能被1和自身整除的数。1不是素数,2是最小的素数。 根据数学定义,要证明一个正整数n是否素数,一个直观的办法,就是用2,3,4,5...n-1,这一系列正整数去一 一除n,如果都不能整除, n就是素数,反之只要有一个能整除n就不是素...

Dim num1 As Integer, num2 As Integer //定义整数型变量num1 ,num2 Dim opnum As Integer //定义整数型变量opnum Randomize //获取随机数种子 num1 = Int(Rnd() * 9) + 10 //num1为10~19之间随机数字 num2 = Int(Rnd() * 9) + 1 //num2为1~10...

Private Sub Form_Load()s = 1For i = 1 To 30If i Mod 2 = 0 Then s = s * iEnd IfNextMsgBox sEnd Sub

Dim jg As Integer, bjg As Integer, s As Integer Private Sub Command1_Click() Dim a(10) As Integer Randomize For i = 1 To 10 a(i) = CInt(InputBox("请输入第" & i & "个学生的成绩:")) If a(i) >= 60 Then jg = jg + 1 Else bjg = bjg ...

网站地图

All rights reserved Powered by www.ndwl.net

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