form1.ebf
来自「Windows CE 应用程序设计随书源码」· EBF 代码 · 共 1,107 行 · 第 1/3 页
EBF
1,107 行
_cy = 450
AutoSize = 0 'False
BackColor = -2147483643
BackStyle = 1
BorderStyle = 0
Caption = "查找类型"
Enabled = -1 'True
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 8.25
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = -2147483640
Alignment = 0
UseMnemonic = -1 'True
WordWrap = 0 'False
End
Begin VBCE.TextBox FindContents
Height = 255
Left = 1200
TabIndex = 19
Top = 240
Width = 1215
_cx = 2143
_cy = 450
BackColor = -2147483643
BorderStyle = 1
Enabled = -1 'True
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 8.25
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = -2147483640
Text = ""
Alignment = 0
HideSelection = -1 'True
Locked = 0 'False
MaxLength = 0
MultiLine = 0 'False
PasswordChar = ""
ScrollBars = 0
End
Begin VBCE.Label Label4
Height = 255
Left = 240
TabIndex = 18
Top = 240
Width = 615
_cx = 1085
_cy = 450
AutoSize = 0 'False
BackColor = -2147483643
BackStyle = 1
BorderStyle = 0
Caption = "关键字"
Enabled = -1 'True
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 8.25
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = -2147483640
Alignment = 0
UseMnemonic = -1 'True
WordWrap = 0 'False
End
Begin VBCE.ComboBox FindWhat
Height = 300
Left = 1200
TabIndex = 17
Top = 555
Width = 735
List = "Form1.frx":0000
ItemData = "Form1.frx":0028
_cx = 1296
_cy = 529
BackColor = -2147483643
Enabled = -1 'True
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 8.25
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = -2147483640
Text = ""
IntegralHeight = -1 'True
Locked = 0 'False
Sorted = 0 'False
Style = 2
End
End
Begin VBCE.CommandButton ComDataFind
Height = 255
Left = 735
TabIndex = 15
TabStop = 0 'False
Top = 3120
Width = 1095
_cx = 1931
_cy = 450
BackColor = 12632256
Caption = "查找记录"
Enabled = -1 'True
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 8.25
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Style = 0
End
Begin VBCE.CommandButton ComDataDel
Height = 255
Left = 1815
TabIndex = 14
TabStop = 0 'False
Top = 3120
Width = 1095
_cx = 1931
_cy = 450
BackColor = 12632256
Caption = "删除记录"
Enabled = -1 'True
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 8.25
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Style = 0
End
Begin VBCE.TextBox ConditionShow
Height = 495
Left = 195
TabIndex = 8
TabStop = 0 'False
Top = 3360
Width = 3255
_cx = 5741
_cy = 873
BackColor = -2147483643
BorderStyle = 1
Enabled = -1 'True
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 8.25
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = -2147483640
Text = ""
Alignment = 0
HideSelection = -1 'True
Locked = -1 'True
MaxLength = 0
MultiLine = 0 'False
PasswordChar = ""
ScrollBars = 0
End
Begin VBCE.CommandButton ComDataAdd
Height = 255
Left = 2355
TabIndex = 7
TabStop = 0 'False
Top = 2880
Width = 1095
_cx = 1931
_cy = 450
BackColor = 12632256
Caption = "增加记录"
Enabled = -1 'True
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 8.25
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Style = 0
End
Begin VBCE.CommandButton ComDataEdit
Height = 255
Left = 1275
TabIndex = 6
TabStop = 0 'False
Top = 2880
Width = 1095
_cx = 1931
_cy = 450
BackColor = 12632256
Caption = "修改记录"
Enabled = -1 'True
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 8.25
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Style = 0
End
Begin VBCE.CommandButton ComDataShow
Height = 255
Left = 195
TabIndex = 0
TabStop = 0 'False
Top = 2880
Width = 1095
_cx = 1931
_cy = 450
BackColor = 12632256
Caption = "显示记录"
Enabled = -1 'True
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 8.25
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Style = 0
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Dim DBFilename As String
Dim conn As ADOCE.connection
Dim DBpoint As Long
Dim FlagAddOrEdit As Boolean 'true to add , false to edit
Private Sub Form_Load()
Dim strPath As String
strPath = App.Path
If strPath = "\" Then
strPath = ""
End If
DBpoint = 1 '初始化游标
DBFilename = "\My Documents\friend.cdb"
FrameDataFind.Top = FrameDataShow.Top
FrameDataFind.Left = FrameDataShow.Left
FrameDataShow.Visible = True
FrameDataFind.Visible = False
FindWhat.AddItem ("姓名")
FindWhat.AddItem ("电话")
FindWhat.AddItem ("住址")
Dim rs
If DBExists(DBFilename) = False Then
On Error Resume Next
Set rs = CreateObject("ADOCE.Recordset.3.0")
rs.Open "CREATE DATABASE '" & DBFilename & "'"
rs.Close
Set rs = Nothing
On Error GoTo 0
SQLCommand "CREATE table FriendTable (FriendName text, FriendTel text,FriendAdd text)"
End If
If DBExists(DBFilename) = True Then
ConditionShow.Text = "数据库准备就绪"
End If
ComDataShow_Click
End Sub
'取消按钮
Private Sub AddDataCancle_Click()
If FlagAddOrEdit = True Then
TextName.Text = ""
TextTel.Text = ""
TextAddress.Text = ""
Else
ComDataShow_Click
End If
ConditionShow.Text = "取消操作"
End Sub
'确定按钮
Private Sub AddDataOK_Click()
If FlagAddOrEdit = True Then
If datacheck(TextName.Text, TextTel.Text, TextAddress.Text) Then
AddData TextName.Text, TextTel.Text, TextAddress.Text
TextName.Text = ""
TextTel.Text = ""
TextAddress.Text = ""
TextName.SetFocus
End If
Else
If connOpen = True And datacheck(TextName.Text, TextTel.Text, TextAddress.Text) = True Then
Dim rs As ADOCE.Recordset
'Dim i As Integer
Set rs = CreateObject("ADOCE.Recordset.3.0")
On Error Resume Next
rs.Open "select * from FriendTable", conn, adOpenKeyset, adLockOptimistic
rs.Move DBpoint - 1, adBookmarkFirst
rs.Fields("FriendName").Value = TextName.Text
rs.Fields("FriendTel").Value = TextTel.Text
rs.Fields("FriendAdd").Value = TextAddress.Text
rs.update
If conn.Errors.Count = 0 Then
ConditionShow.Text = "修改数据成功!"
Else
ConditionShow.Text = "修改数据失败!"
End If
On Error GoTo 0
rs.Close
connClose
End If
End If
End Sub
'增加数据按钮
Private Sub ComDataAdd_Click()
FrameDataShow.Visible = True
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?