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

📄 optimumpath2.frm

📁 本程序是一个用prim算法寻找最小生成树的小程序。
💻 FRM
字号:
VERSION 5.00
Begin VB.Form Form3 
   BorderStyle     =   4  'Fixed ToolWindow
   Caption         =   "Form3"
   ClientHeight    =   1065
   ClientLeft      =   6495
   ClientTop       =   6060
   ClientWidth     =   3525
   LinkTopic       =   "Form3"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   1065
   ScaleWidth      =   3525
   ShowInTaskbar   =   0   'False
   Begin VB.CommandButton Command2 
      Caption         =   "Command2"
      Height          =   375
      Left            =   2640
      TabIndex        =   7
      Top             =   480
      Width           =   855
   End
   Begin VB.CommandButton Command1 
      Caption         =   "Command1"
      Height          =   375
      Left            =   1680
      TabIndex        =   6
      Top             =   480
      Width           =   855
   End
   Begin VB.TextBox Text4 
      Height          =   375
      Left            =   2640
      TabIndex        =   5
      Text            =   "Text4"
      Top             =   0
      Width           =   855
   End
   Begin VB.TextBox Text2 
      Height          =   375
      Left            =   960
      TabIndex        =   3
      Text            =   "Text2"
      Top             =   480
      Width           =   615
   End
   Begin VB.TextBox Text1 
      Height          =   375
      Left            =   960
      TabIndex        =   2
      Text            =   "Text1"
      Top             =   0
      Width           =   615
   End
   Begin VB.Label Label4 
      Caption         =   "Label4"
      Height          =   375
      Left            =   1680
      TabIndex        =   4
      Top             =   0
      Width           =   975
   End
   Begin VB.Label Label2 
      Caption         =   "Label2"
      Height          =   375
      Left            =   0
      TabIndex        =   1
      Top             =   480
      Width           =   855
   End
   Begin VB.Label Label1 
      Caption         =   "Label1"
      Height          =   255
      Left            =   0
      TabIndex        =   0
      Top             =   120
      Width           =   855
   End
End
Attribute VB_Name = "Form3"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit

Private Sub Command1_Click()
On Error GoTo epr
If Val(Text1.Text) = Val(Text2.Text) Or Not isexistnode(Trim(Text1.Text), Trim(Text2.Text)) Or Not IsNumeric(Text1.Text) Or Not IsNumeric(Text2.Text) Then
n = MsgBox("不能要环;你输入的接点号不对", vbOKOnly, "警告")
Exit Sub
End If
cn.Execute "insert into arc values('" & Trim(Text1.Text) & "','" & Trim(Text2.Text) & "','" & Trim(Text4.Text) & "')"
Call Form1.pref
Exit Sub
epr:
MsgBox Err.Description, vbOKCancel, "error"
End Sub

Private Sub Command2_Click()
Unload Form3
End Sub

Private Sub Form_Load()
Label1.Caption = "开始节点"
Label2.Caption = "终止节点"
Label4.Caption = "权值"
Text1.Text = ""
Text2.Text = ""
Text4.Text = ""
Command1.Caption = "确定"
Command2.Caption = "退出"
End Sub
Function isexistnode(ByVal st1 As String, ByVal st2 As String) As Boolean
Dim i1 As Integer, i As Integer
i1 = 0
isexistnode = False
rs.Open "select * from vertex", cn, adOpenKeyset, adLockPessimistic
If rslen(rs) <= 0 Then isexistnode = False: rs.Close: Exit Function
For i = 1 To rslen(rs)
If rs("id").Value = st1 Then i1 = i1 + 1
If rs("id").Value = st2 Then i1 = i1 + 1
rs.MoveNext
Next i
rs.Close
If i1 >= 2 Then isexistnode = True
End Function

⌨️ 快捷键说明

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