1、Private Sub Command1_Click() Text1.Text = Label1.CaptionPrivate Sub Command2_Click() End2-7 Print Tab(5); *Print Tab(4);*Print Tab(3);*Print Tab(2);*ClsPrivate Sub Command3_Click()Move 0, 02-8 Text1 = 千里之行,始于足下 Text1.Left = Form1.Width - Text1.Width Command1.Enabled = False Text1.Visible = True Text
2、1.Visible = False Command1.Enabled = True3-1 Dim f As Single, c As SingleDim answer As IntegerPrivate Sub Cmdend_Click()Private Sub Cmdhs_Click() f = Val(Txthua.Text) c = (f - 32) * 5 / 9 Txtshe.Text = Str$(c)Private Sub Cmdsh_Click() c = Val(Txtshe.Text) If c = 0 Then Txthua.Text = 32 ElseIf c 0 Th
3、en f = (c * 9# / 5) + 32 Txthua.Text = Str$(f) Else answer = MsgBox(非法数据!, vbOKOnly + vbExclamation, 提示信息) If answer = vbOK Then Txtshe.Text = Txtshe.SetFocus End If3-2 Option ExplicitDim fs As IntegerPrivate Sub cmdGreat_Click() Text1.Text = UCase(Text1.Text)Private Sub cmdRecall_Click() Text2.Text
4、 = Len(Text1.Text)Private Sub cmdSmall_Click() Text1.Text = LCase(Text1.Text)3-3 Private Sub Form_Click() Dim s1 As Single, s2 As Single, s3 As Single Dim str1 As String, str2 As String Dim b1 As Boolean, b2 As Boolean, b3 As Boolean Dim n1 As Integer, n2 As Integer, n3 As Integer s1 = 18 4 * 4# 2 /
5、 1.6 s2 = 25 3 Mod 3.2 * Int(2.5) str1 = UCase(Xyz) & 1234 & LCase(abC b1 = 3 4 Or 5 4 b2 = True And False n1 = Int(-3.5) + Fix(3.5) + CInt(2.6) n2 = Len(Str(123) + Hello s3 = Sgn(7 Mod 3 - 4) + 0.75 b3 = aeoplane = 1600 Then zgz = gz * (1 + 0.1) ElseIf gz = 1400 Then zgz = gz * (1 + 0.15) zgz = gz
6、* (1 + 0.2) txtZGz = CStr(zgz) txtGz = txtZGz = txtGz.SetFocus4-4 Dim t As Integer, y As Single t = Val(txtTime) If t 10 Then y = 30 ElseIf t 50 Then y = 30 + (t - 10) * 3 y = 30 + (t - 10) * 2.5 If y = 90 Then Text2.Text = A ElseIf cj = 80 ThenB= 70 ThenC= 60 ThenD= 0 ThenEText2.Text = Private Sub
7、Text1_LostFocus()If Not IsNumeric(Text1.Text) Or Val(Text1.Text) MsgBox 数据输入错误,重输Text1.SetFocusEnd If4-6 Dim Y As Integer, m As Integer Dim d As Integer, w1 As Integer Dim Rq As Date Dim w2 As String Rq = Date Y = Year(Rq) m = Month(Rq) d = Day(Rq) w1 = Weekday(Rq) Select Case w1 Case 1 w2 = 日 Case
8、2一 Case 3二 Case 4三 Case 5四 Case 6五 Case 7六 End Select Label1.Caption = 今天是 & Y &年 m &月 d &星期 w24-7 Dim Y1 As Integer, M1 As IntegerDim flag As Boolean, D1 As Integer, S1 As StringY1 = Val(txtYear)M1 = Val(txtMonth)flag = (Y1 Mod 4 = 0 And Y1 Mod 100 0) Or Y1 Mod 400 = 0Select Case M1Case 1, 2, 3 D1
9、= 31: S1 = 一季度 If M1 = 2 Then If flag Then D1 = 29 D1 = 28Case 4, 5, 6 D1 = 30:二季度If M1 = 5 Then D1 = 31Case 7, 8, 9三季度If M1 = 9 Then D1 = 30Case 10, 11, 12四季度If M1 = 11 Then D1 = 30End SelectIf flag Then txtRun = 是闰年不是闰年txtSea = S1txtDays = Str(D1)txtYear = txtMonth = txtSea = txtRun = txtDays = 4-
10、8 Private Sub Cmdclear_Click() txta.Text = Txtb.Text = Txtc.Text = Txtx1.Text = Txtx2.Text = txta.SetFocusPrivate Sub Cmdcup_Click() a = Val(txta.Text) b = Val(Txtb.Text) c = Val(Txtc.Text) disc = b * b - 4 * a * c p = -b / (2 * a) q = Sqr(Abs(disc) / (2 * a) If disc Txtx1 = Format$(p + q, #0.# Txtx
11、2 = Format$(p - q, Txtx1 = Str$(p) &+ Str$(q) &i Txtx2 = Str$(p) &-Private Sub txta_KeyPress(KeyAscii As Integer)If KeyAscii = 13 Then If Not IsNumeric(txta.Text) Then MsgBox 数据非法,重输 Txtb.SetFocus End SubPrivate Sub Txtb_KeyPress(KeyAscii As Integer) If Not IsNumeric(Txtb.Text) Then Txtc.SetFocusPri
12、vate Sub Txtc_KeyPress(KeyAscii As Integer) If Not IsNumeric(Txtc.Text) Then Cmdcup.SetFocus4-9 txtm1 = txtm2 = txtm3 = Lblinfo.Caption = txtm1.SetFocusPrivate Sub Cmdsort_Click() Dim m1 As Integer, m2 As Integer, m3 As Integer m1 = Val(txtm1.Text) m2 = Val(txtm2.Text) m3 = Val(txtm3.Text) If (m1 +
13、m2 + m3) 3 95 Or (m1 = 100 And m2 = 100 And m3 = 80) _ Or (m1 = 100 And m3 = 100 And m2 = 80) Or _ (m1 = 80 And m2 = 100 And m3 = 100) Then Lblinfo.Caption = 此学生奖学金为一等奖 ElseIf (m1 + m2 + m3) 3 90 Or (m1 = 100 And m2 = 75 And m3 = 75) _ Or (m1 = 75 And m2 = 100 And m3 = 75) Or _= 75 And m2 = 75 And m3 = 100) Then此学生奖学金为二等奖 ElseIf m1 = 70 And m2 = 70 And m3 此学生奖学金为三等奖此学生无奖学金Private Sub txtm1_KeyPress(KeyAscii As Integer) If Not IsNumeric(txtm1) Then数据非法,重新输入, vbExclamation, 输入操作数1 txtm1.Text = txtm1.SetFocus txtm2.SetFocusPrivate Sub txtm2_KeyPress(KeyAsc
copyright@ 2008-2022 冰豆网网站版权所有
经营许可证编号:鄂ICP备2022015515号-1