⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 frmmain.frm

📁 主要介绍的是浏览学生成绩的程序,方法比较容易.
💻 FRM
字号:
VERSION 5.00
Begin VB.Form frmMain 
   BorderStyle     =   1  'Fixed Single
   Caption         =   "求解二元一次方程组"
   ClientHeight    =   3540
   ClientLeft      =   45
   ClientTop       =   435
   ClientWidth     =   6195
   Icon            =   "frmMain.frx":0000
   LinkTopic       =   "Form1"
   LockControls    =   -1  'True
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   3540
   ScaleWidth      =   6195
   StartUpPosition =   2  '屏幕中心
   Begin VB.CommandButton cmdReset 
      Caption         =   "重新求解"
      BeginProperty Font 
         Name            =   "黑体"
         Size            =   12
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   465
      Left            =   4155
      TabIndex        =   12
      Top             =   2025
      Width           =   1365
   End
   Begin VB.CommandButton cmdCal 
      Caption         =   "计算二元一次方程组的解"
      BeginProperty Font 
         Name            =   "黑体"
         Size            =   12
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   465
      Left            =   540
      TabIndex        =   11
      Top             =   2025
      Width           =   3210
   End
   Begin VB.TextBox txtC2 
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   14.25
         Charset         =   134
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   405
      Left            =   4545
      TabIndex        =   10
      Text            =   "1234"
      Top             =   1395
      Width           =   975
   End
   Begin VB.TextBox txtB2 
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   14.25
         Charset         =   134
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   405
      Left            =   2760
      TabIndex        =   8
      Text            =   "1234"
      Top             =   1395
      Width           =   975
   End
   Begin VB.TextBox txtA2 
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   14.25
         Charset         =   134
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   405
      Left            =   945
      TabIndex        =   6
      Text            =   "1234"
      Top             =   1395
      Width           =   975
   End
   Begin VB.TextBox txtC1 
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   14.25
         Charset         =   134
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   405
      Left            =   4560
      TabIndex        =   5
      Text            =   "1234"
      Top             =   720
      Width           =   975
   End
   Begin VB.TextBox txtB1 
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   14.25
         Charset         =   134
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   405
      Left            =   2760
      TabIndex        =   3
      Text            =   "1234"
      Top             =   720
      Width           =   975
   End
   Begin VB.TextBox txtA1 
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   14.25
         Charset         =   134
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   405
      Left            =   960
      TabIndex        =   1
      Text            =   "1234"
      Top             =   720
      Width           =   975
   End
   Begin VB.Label lblValue 
      BackStyle       =   0  'Transparent
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   14.25
         Charset         =   134
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   420
      Left            =   540
      TabIndex        =   13
      Top             =   2655
      Width           =   4965
   End
   Begin VB.Label Label5 
      BackStyle       =   0  'Transparent
      Caption         =   "X2 ="
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   14.25
         Charset         =   134
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   255
      Left            =   3765
      TabIndex        =   9
      Top             =   1485
      Width           =   735
   End
   Begin VB.Label Label4 
      BackStyle       =   0  'Transparent
      Caption         =   "X1 +"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   14.25
         Charset         =   134
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   255
      Left            =   1965
      TabIndex        =   7
      Top             =   1485
      Width           =   735
   End
   Begin VB.Label Label3 
      BackStyle       =   0  'Transparent
      Caption         =   "X2 ="
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   14.25
         Charset         =   134
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   255
      Left            =   3780
      TabIndex        =   4
      Top             =   810
      Width           =   735
   End
   Begin VB.Label Label2 
      BackStyle       =   0  'Transparent
      Caption         =   "X1 +"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   14.25
         Charset         =   134
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   255
      Left            =   1980
      TabIndex        =   2
      Top             =   810
      Width           =   735
   End
   Begin VB.Image Image1 
      Height          =   1110
      Left            =   540
      Picture         =   "frmMain.frx":0442
      Stretch         =   -1  'True
      Top             =   720
      Width           =   405
   End
   Begin VB.Label Label1 
      BackStyle       =   0  'Transparent
      Caption         =   "输入参数值:"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   15.75
         Charset         =   134
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H00FF0000&
      Height          =   375
      Left            =   120
      TabIndex        =   0
      Top             =   120
      Width           =   2040
   End
End
Attribute VB_Name = "frmMain"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub cmdCal_Click()
    Dim x1 As Double, x2 As Double
    If check = 1 Then
        lblValue.Caption = "请检查输入是否完整"
    ElseIf check = 2 Then
        lblValue.Caption = "输入了非法字符"
    ElseIf check = 3 Then
        lblValue.Caption = "方程组有无穷多个解"
    Else
        calculate x1, x2
        lblValue.Caption = "x1=" & Format(CStr(x1), "0.00") & "  x2=" & Format(CStr(x2), "0.00")
    End If
End Sub

Private Sub cmdReset_Click()
    FormInit
    txtA1.SetFocus
End Sub

Private Sub Form_Load()
    Me.BackColor = RGB(192, 192, 192)
    FormInit
End Sub

Private Sub FormInit()
    txtA1.Text = ""
    txtB1.Text = ""
    txtC1.Text = ""
    txtA2.Text = ""
    txtB2.Text = ""
    txtC2.Text = ""
    lblValue.Caption = ""
End Sub

Private Function check() As Integer
    If txtA1.Text = "" Or _
       txtB1.Text = "" Or _
       txtC1.Text = "" Or _
       txtA2.Text = "" Or _
       txtB2.Text = "" Or _
       txtC2.Text = "" Then
       
       check = 1
       Exit Function
    End If
    
    If Not IsNumeric(txtA1.Text) Or _
       Not IsNumeric(txtB1.Text) Or _
       Not IsNumeric(txtC1.Text) Or _
       Not IsNumeric(txtA2.Text) Or _
       Not IsNumeric(txtB2.Text) Or _
       Not IsNumeric(txtC2.Text) Then
       
       check = 2
       Exit Function
    End If
    
    If Val(txtA1.Text) * Val(txtB2.Text) = Val(txtA2.Text) * Val(txtB1.Text) Then
        check = 3
    End If
End Function

Private Sub calculate(x As Double, y As Double)
    Dim a1 As Double, b1 As Double, c1 As Double
    Dim a2 As Double, b2 As Double, c2 As Double
    
    a1 = Val(txtA1.Text)
    b1 = Val(txtB1.Text)
    c1 = Val(txtC1.Text)
    a2 = Val(txtA2.Text)
    b2 = Val(txtB2.Text)
    c2 = Val(txtC2.Text)
    
    x = (c1 * b2 - c2 * b1) / (a1 * b2 - a2 * b1)
    y = (a1 * c2 - a2 * c1) / (a1 * b2 - a2 * b1)
End Sub

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -