?? cheliangmingcheng.frm
字號:
VERSION 5.00
Object = "{5E9E78A0-531B-11CF-91F6-C2863C385E30}#1.0#0"; "msflxgrd.ocx"
Begin VB.Form cheliangmingcheng
Caption = "車輛名稱"
ClientHeight = 5655
ClientLeft = 60
ClientTop = 345
ClientWidth = 8805
LinkTopic = "Form1"
ScaleHeight = 5655
ScaleWidth = 8805
StartUpPosition = 3 '窗口缺省
Begin VB.Frame Frame2
Height = 4575
Left = 3240
TabIndex = 1
Top = 360
Width = 5415
Begin MSFlexGridLib.MSFlexGrid MSF
Height = 3735
Left = 120
TabIndex = 10
Top = 360
Width = 5055
_ExtentX = 8916
_ExtentY = 6588
_Version = 393216
FixedCols = 0
AllowUserResizing= 3
End
End
Begin VB.Frame Frame1
Height = 4575
Left = 240
TabIndex = 0
Top = 360
Width = 2895
Begin VB.Frame Frame3
Height = 1095
Left = 0
TabIndex = 11
Top = 3480
Width = 2895
Begin VB.CommandButton Command3
Caption = "修 改"
Height = 375
Left = 1920
TabIndex = 14
Top = 360
Width = 855
End
Begin VB.CommandButton Command2
Caption = "刪 除"
Height = 375
Left = 1080
TabIndex = 13
Top = 360
Width = 855
End
Begin VB.CommandButton Command1
Caption = "保 存"
Height = 375
Left = 240
TabIndex = 12
Top = 360
Width = 855
End
End
Begin VB.TextBox Text4
Height = 375
Left = 1680
TabIndex = 9
Top = 2520
Width = 855
End
Begin VB.TextBox Text3
Height = 375
Left = 840
TabIndex = 8
Top = 1800
Width = 1215
End
Begin VB.TextBox Text2
Height = 375
Left = 840
TabIndex = 7
Top = 1200
Width = 1575
End
Begin VB.TextBox Text1
Height = 375
Left = 840
TabIndex = 6
Top = 600
Width = 1575
End
Begin VB.Label Label4
Caption = "百公里耗油標準:"
Height = 375
Left = 240
TabIndex = 5
Top = 2640
Width = 1575
End
Begin VB.Label Label3
Caption = "司機:"
Height = 375
Left = 240
TabIndex = 4
Top = 1920
Width = 975
End
Begin VB.Label Label2
Caption = "車牌:"
Height = 375
Left = 240
TabIndex = 3
Top = 1320
Width = 1095
End
Begin VB.Label Label1
Caption = "車型:"
Height = 255
Left = 240
TabIndex = 2
Top = 720
Width = 735
End
End
End
Attribute VB_Name = "cheliangmingcheng"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
'Dim Db As Database
Dim result, result1, result2 As Recordset
Dim sql As String
Private Sub Command1_Click()
If MsgBox("確認保存嗎?", vbYesNo, "警告") = vbYes Then
sql = "insert into cheliangmingcheng values('" & Trim(Text1.Text) & "','" & Trim(Text2.Text) & "','" & Trim(Text3.Text) & "','" & Trim(Text4.Text) & "')"
result.Open sql, con, adOpenStatic, adLockOptimistic
' result.AddNew
' result!車型 = Trim(Text1.Text)
' result!車牌 = Trim(Text2.Text)
' result!司機 = Trim(Text3.Text)
' result!百公里耗油標準 = Trim(Text4.Text)
' result.Update
Call bb
End If
End Sub
Private Sub Command2_Click()
If MsgBox("確認刪除嗎?", vbYesNo, "警告") = vbYes Then
sql = "delete from cheliangmingcheng where 車型='" & Trim(Text1.Text) & "' and 車牌='" & Trim(Text2.Text) & "'"
result.Open sql, con, adOpenStatic, adLockOptimistic
Call bb
End If
End Sub
Private Sub Command3_Click()
sql = "delete from cheliangmingcheng where 車型='" & Trim(Text1.Text) & "' and 車牌='" & Trim(Text2.Text) & "'"
result.Open sql, con, adOpenStatic, adLockOptimistic
sql = "insert into cheliangmingcheng values('" & Trim(Text1.Text) & "','" & Trim(Text2.Text) & "','" & Trim(Text3.Text) & "','" & Trim(Text4.Text) & "')"
result.Open sql, con, adOpenStatic, adLockOptimistic
Call bb
End Sub
Private Sub Form_Load()
' Set Db = Workspaces(0).OpenDatabase(App.Path & "\cheliang.MDB")
' Set RS = Db.OpenRecordset("SELECT * FROM cheliangmingcheng")
' sql = "SELECT * FROM cheliangmingcheng"
' Set result = Db.OpenRecordset(sql)
' Call bb
Move Screen.Width / 2 - cheliangmingcheng.Width / 2, Screen.Height / 2 - cheliangmingcheng.Height / 2
MSF.FormatString = " 車 型 |^ 車 牌 |^ 司機 |^ 百公里耗油標準 "
Call aa
Set result = New Recordset
Set result1 = New Recordset
Set result2 = New Recordset
Call bb
End Sub
Sub bb()
MSF.Clear
MSF.FormatString = " 車 型 |^ 車 牌 |^ 司機 |^ 百公里耗油標準 "
MSF.Rows = 2
sql = "select * from cheliangmingcheng "
result.Open sql, con, adOpenStatic, adLockOptimistic
If result.RecordCount <> 0 Then
result.MoveFirst
Dim i As Integer
i = 1
Do While Not result.EOF
MSF.TextArray(i * MSF.Cols) = Trim(result("車型"))
MSF.TextArray(i * MSF.Cols + 1) = Trim(result("車牌"))
MSF.TextArray(i * MSF.Cols + 2) = Trim(result("司機"))
MSF.TextArray(i * MSF.Cols + 3) = Trim(result("百公里耗油標準"))
i = i + 1
MSF.Rows = MSF.Rows + 1
result.MoveNext
Loop
End If
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
Text4.Text = ""
' Text1.SetFocus
result.Close
End Sub
Private Sub MSF_DblClick()
Text1.Text = MSF.TextArray(MSF.Row * MSF.Cols)
Text2.Text = MSF.TextArray(MSF.Row * MSF.Cols + 1)
Text3.Text = MSF.TextArray(MSF.Row * MSF.Cols + 2)
Text4.Text = MSF.TextArray(MSF.Row * MSF.Cols + 3)
End Sub
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -