ldcf.net
当前位置:首页 >> vB程序题求代码 >>

vB程序题求代码

'这题目,对于初学者是很有难度的,'运行效果如上图,代码如下:'有问题可以问我Private Sub Command1_Click()Dim arr(1 To 20) As IntegerDim i, a, b As IntegerDim Ave As DoubleDim sum As IntegerDim Mx, Mn As IntegerPrint "随机数数组...

Private Sub Command1_Click() Randomize Text1 = "" n = CInt(InputBox("N=")) For i = 1 To n x = Int(Rnd * 90) + 10 If x Mod 2 = 1 Then Text1 = Text1 & x & " " n1 = n1 + 1 If n1 Mod 10 = 0 Then Text1 = Text1 & vbCrLf s1 = s1 + x ...

Dim sum#Private Sub Form1_Click() Dim i% sum = 1 For i = 1 To 10 sum = sum * i Next Print sumEnd Sub

设计界面: 修改属性: 窗体Frm1代码: Public n% '定义公共变量Private Sub Command1_Click() Frm2.ShowEnd SubPublic Sub Command2_Click() Print nEnd Sub窗体Frm2代码: Private Sub Command1_Click() If MsgBox("退出程序吗?", vbYesNo, "...

Private Sub Clear_Click() Text1.Text = "" Text2.Text = "" List1.Clear Text1.SetFocus End Sub Private Sub Lookup_Click() Dim i As Integer, j As Integer, c As String, b(50) As String, k As Integer, t As String c = Me.Text1.Text F...

Private Sub Command1_Click() x = InputBox("键入第一个数") y = InputBox("键入第二个数") z = InputBox("键入第三个数") Max = x If Max < y Then Max = y If Max < z Then Max = z Print "最大值"; Max End Sub

Dim Flag As BooleanPrivate Sub Command1_Click() Timer1.Enabled = TrueEnd SubPrivate Sub Form_Load() Timer1.Enabled = False Timer1.Interval = 1000 Label2.BackColor = vbYellow Label2.ForeColor = vbRed Flag = TrueEnd SubPrivate Su...

建立 VB 工程,并设计窗体如下: 编写代码如下: Private Sub btnCopy_Click() If Text1.SelLength = 0 Then Exit Sub Else Clipboard.Clear Clipboard.SetText Text1.SelText End IfEnd SubPrivate Sub btnCut_Click() If Text1.SelLength = 0 ...

Dim Sign As String, Flag As BooleanPrivate Sub Command1_Click() Dim DecimalNumber As Double DecimalNumber = TransformBtoD(Text1.Text) Label2.Caption = "转换成十进制数为:" + Sign + CStr(DecimalNumber)End SubPrivate Function Tra...

Function getMax() As Integer Dim i As Integer, rt As Integer rt = Num(0) For i = 1 To 9 If Num(i) > t Then t = Num(i) Next getMax = rt End Function Function getMin() As Integer Dim i As Integer, rt As Integer rt = Num(0) For i ...

网站首页 | 网站地图
All rights reserved Powered by www.ldcf.net
copyright ©right 2010-2021。
内容来自网络,如有侵犯请联系客服。zhit325@qq.com