麻烦高手用vb编几个程序
发布网友
发布时间:2022-05-07 12:26
我来回答
共2个回答
热心网友
时间:2023-05-18 23:28
文本框的passwordchar="*"
第一个问题:要逐行显示只要把文本框的MultiLine的属性改为"true"就行了。全部改好了
Option Explicit
Dim Idata() As Integer
Dim MaxD As Integer
Dim MinD As Integer
Private Sub CmdExit_Click()
End
End Sub
Private Sub CmdLoad_Click()
Dim I As Integer
Dim S As String
Open "e:\111.txt" For Input As #1
I = 0
Do While Not EOF(1) ' 循环至文件尾。
I = I + 1
ReDim Preserve Idata(I)
Input #1, S ' 读入数字。
Idata(I - 1) = Int(S)
Loop
Close #1
End Sub
Private Sub CmdShow_Click()
Dim I As Integer
Text1 = ""
For I = LBound(Idata) To UBound(Idata) - 1
Text1.Text = Text1.Text & Idata(I) & vbCrLf
Next
End Sub
Private Sub CmdSort_Click()
Dim I As Integer, J As Integer
Dim Tmp As Integer
For I = 1 To UBound(Idata)
For J = UBound(Idata) To I Step -1
If Idata(J) > Idata(J - 1) Then
Tmp = Int(Idata(J))
Idata(J) = Idata(J - 1)
Idata(J - 1) = Tmp
End If
Next J
Next I
Text2 = ""
For I = LBound(Idata) To UBound(Idata) - 1
Text2.Text = Text2.Text & Idata(I) & vbCrLf
Next
I = LBound(Idata)
J = UBound(Idata)
MinD = Idata(I)
MaxD = Idata(J)
End Sub
Private Sub CmdTJ_Click()
Dim I As Integer
Dim L As Double
For I = LBound(Idata) To UBound(Idata) - 1
L = L + Idata(I)
Next
L = L / UBound(Idata)
Form2.Show
With Form2.Text1
.Text = ""
.Text = "最小值:" & MinD & vbCrLf
.Text = .Text & "最大值:" & MaxD & vbCrLf
.Text = .Text & "平均值:" & L
End With
End Sub
‘----------------------------
第二个问题
form1代码
Option Explicit
Dim ErrN As Integer
Private Sub CmdCancel_Click()
End
End Sub
Private Sub CmdOK_Click()
Dim Sfound As Boolean
Dim S As String
Dim A() As String
ErrN = ErrN + 1
If ErrN > 3 Then
MsgBox "超过三次", vbInformation, "错误"
End
End If
Open "e:\pass.txt" For Input As #1
Sfound = False
Do While Not EOF(1) ' 循环至文件尾。
Input #1, S ' 读入数字。
A = Split(S, ":")
If A(0) = TxtUser.Text And A(1) = TxtPass.Text Then
MsgBox "欢迎使用本系统!"
Form2.Show
Unload Me
Exit Do
End If
Loop
Close #1
End Sub
Private Sub Form_Load()
ErrN = 0
End Sub
form2代码
Option Explicit
Private Sub Form_Load()
Label1.Caption = "距奥运开幕还有:" & CStr(CDate("2008-8-8") - Date) & "天"
End Sub
热心网友
时间:2023-05-18 23:28
说白了 想要你的分 加----------我-----------Q 在线编码~~~~~~
691479813