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

窗体上加一个按钮,完整代码如下: 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. Private Sub Command1_Click() If Val(Text1.Text) > 0 Then Text2.text= "正数" If Val(Text1.Text) < 0 Then Text2.text = "负数" If Val(Text1.Text) = 0 Then Text2.text = 0 End Sub 2. Private Sub Command1_Click() Dim t As String t...

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

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

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

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

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 Form_Click() Dim s As String, i As Integer, n As Integer s = InputBox("input your str...", , "abCDEf") For i = 1 To Len(s) Select Case (Mid(s, i, 1)) Case "a" To "z" n = n + 1 End Select Next MsgBox "character:" & n...

网站地图

All rights reserved Powered by www.ndwl.net

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