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

📄 frmlearning.frm

📁 用XML做专家系统的一个编译器,有说明书,使用简单,有模板
💻 FRM
字号:
VERSION 5.00
Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.2#0"; "COMDLG32.OCX"
Object = "{5E9E78A0-531B-11CF-91F6-C2863C385E30}#1.0#0"; "Msflxgrd.ocx"
Object = "{BDC217C8-ED16-11CD-956C-0000C04E4C0A}#1.1#0"; "TABCTL32.OCX"
Begin VB.Form frmLearning 
   BorderStyle     =   1  'Fixed Single
   Caption         =   "Learning"
   ClientHeight    =   4560
   ClientLeft      =   48
   ClientTop       =   336
   ClientWidth     =   5904
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   4560
   ScaleWidth      =   5904
   StartUpPosition =   1  'CenterOwner
   Begin VB.CommandButton CmdRule 
      Caption         =   "生成规则"
      Height          =   372
      Left            =   3120
      TabIndex        =   5
      Top             =   4080
      Width           =   972
   End
   Begin VB.CommandButton CmdCancel 
      Caption         =   "取消"
      Height          =   375
      Left            =   4440
      TabIndex        =   6
      Top             =   4080
      Width           =   975
   End
   Begin VB.CommandButton CmdLearn 
      Caption         =   "学习"
      Height          =   375
      Left            =   1800
      TabIndex        =   4
      Top             =   4080
      Width           =   975
   End
   Begin VB.CommandButton CmdLoad 
      Caption         =   "载入 ..."
      Height          =   375
      Left            =   480
      TabIndex        =   3
      Top             =   4080
      Width           =   975
   End
   Begin MSComDlg.CommonDialog CdlgPath 
      Left            =   0
      Top             =   3960
      _ExtentX        =   847
      _ExtentY        =   847
      _Version        =   393216
   End
   Begin TabDlg.SSTab SSTab1 
      Height          =   3900
      Left            =   120
      TabIndex        =   1
      Top             =   120
      Width           =   5655
      _ExtentX        =   9970
      _ExtentY        =   6879
      _Version        =   393216
      Style           =   1
      Tabs            =   2
      TabHeight       =   520
      TabCaption(0)   =   "载入样本"
      TabPicture(0)   =   "frmLearning.frx":0000
      Tab(0).ControlEnabled=   -1  'True
      Tab(0).Control(0)=   "MSFlexGrid1"
      Tab(0).Control(0).Enabled=   0   'False
      Tab(0).ControlCount=   1
      TabCaption(1)   =   "学习结果"
      TabPicture(1)   =   "frmLearning.frx":001C
      Tab(1).ControlEnabled=   0   'False
      Tab(1).Control(0)=   "MSFlexGrid2"
      Tab(1).ControlCount=   1
      Begin MSFlexGridLib.MSFlexGrid MSFlexGrid1 
         Height          =   3430
         Left            =   15
         TabIndex        =   0
         Top             =   390
         Width           =   5595
         _ExtentX        =   9885
         _ExtentY        =   6033
         _Version        =   393216
         Rows            =   5
         Cols            =   5
         TextStyle       =   4
         FocusRect       =   2
         AllowUserResizing=   3
         PictureType     =   1
         BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
            Name            =   "MS Sans Serif"
            Size            =   7.8
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
      End
      Begin MSFlexGridLib.MSFlexGrid MSFlexGrid2 
         Height          =   3435
         Left            =   -74985
         TabIndex        =   2
         Top             =   390
         Width           =   5595
         _ExtentX        =   9864
         _ExtentY        =   6054
         _Version        =   393216
         Rows            =   5
         Cols            =   5
         TextStyle       =   4
         FocusRect       =   2
         AllowUserResizing=   3
         PictureType     =   1
         BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
            Name            =   "MS Sans Serif"
            Size            =   7.8
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
      End
   End
End
Attribute VB_Name = "frmLearning"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Public TableName As String
Dim strPath As String
Dim DB As Database
Dim rsTitles As Recordset
Dim strSQl As String


Private Sub CmdLearn_Click()
CmdLearn.Enabled = False
CmdRule.Enabled = False
SSTab1.Tab = 1
Call SampleLearn
CmdRule.Enabled = True
End Sub

Private Sub CmdCancel_Click()
Close
Unload Me
End Sub


Private Sub CmdLoad_Click()
Dim i, j As Integer
CdlgPath.DialogTitle = "Browse for database file..." 'set the dialog title
CdlgPath.Filter = "Database files|*.mdb"
CdlgPath.CancelError = True
'打开数据库失败就退出
On Error GoTo errorhand
CdlgPath.ShowOpen

Dim frmSelectTable1 As New frmSelectTable
Set DB = OpenDatabase(CdlgPath.filename, , True, "Access")
For i = 0 To DB.TableDefs.count - 1
    If Left(DB.TableDefs(i).Name, 4) <> "MSys" Then
        frmSelectTable1.List1.AddItem DB.TableDefs(i).Name
    End If
Next
frmSelectTable1.Show vbModal
    
    'open the recordset
    Set rsTitles = DB.OpenRecordset(TableName)
   
    'setup the grid
    MSFlexGrid1.Cols = rsTitles.Fields.count
    MSFlexGrid1.Rows = rsTitles.RecordCount + 1
    For i = 0 To MSFlexGrid1.Cols - 1
        MSFlexGrid1.ColWidth(i) = MSFlexGrid1.Width / 5
        MSFlexGrid1.TextMatrix(0, i) = rsTitles.Fields(i).Name
    Next
     'show all records (titles)
    j = 0
    Do While Not rsTitles.EOF
        For i = 0 To rsTitles.Fields.count - 1
            MSFlexGrid1.TextMatrix(j + 1, i) = rsTitles.Fields(i).value
        Next
        j = j + 1
        rsTitles.MoveNext
    Loop
    CmdLearn.Enabled = True
errorhand:   Exit Sub
End Sub

Private Sub CmdRule_Click()
Dim i, j As Integer
Dim rule_string As String
rule_string = "从样本中获取的产生式规则为:" + vbCrLf + vbCrLf
For i = 1 To MSFlexGrid2.Rows - 1
    rule_string = rule_string + "第" + CStr(i) + "条规则:  "
    rule_string = rule_string + "IF" + "    "
    For j = 1 To MSFlexGrid2.Cols - 2
        If MSFlexGrid2.TextMatrix(i, j) = "1" Then
            rule_string = rule_string + MSFlexGrid2.TextMatrix(0, j) + "    "
        End If
        If MSFlexGrid2.TextMatrix(i, j) = "0" Then
            rule_string = rule_string + "﹁" + MSFlexGrid2.TextMatrix(0, j) + "    "
        End If
    Next
    rule_string = rule_string + "THEN" + "    " + MSFlexGrid2.TextMatrix(0, j) + vbCrLf + vbCrLf
Next
MsgBox rule_string
CmdRule.Enabled = False
      
End Sub

Private Sub Form_Load()
CmdLearn.Enabled = False
CmdRule.Enabled = False
End Sub

Private Sub Form_Unload(Cancel As Integer)
'rsTitles.Close
Set rsTitles = Nothing
'DB.Close
Set DB = Nothing
End Sub

⌨️ 快捷键说明

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