VB的模糊查找问
题
快递公司问题件快递公司问题件货款处理关于圆的周长面积重点题型关于解方程组的题及答案关于南海问题
(VB
教程
人力资源管理pdf成真迷上我教程下载西门子数控教程protel99se入门教程fi6130z安装使用教程
第三版)
习题12.19:
编写程序
设计
领导形象设计圆作业设计ao工艺污水处理厂设计附属工程施工组织设计清扫机器人结构设计
个人信息查询工具。要求使用菜单来控制数据的编织、查找,可完成按姓名查找、按工资查找、按工作证号查找的功能。查找时使用模糊查找,将满足条件的
记录
混凝土 养护记录下载土方回填监理旁站记录免费下载集备记录下载集备记录下载集备记录下载
显示在列
表
关于同志近三年现实表现材料材料类招标技术评分表图表与交易pdf视力表打印pdf用图表说话 pdf
框中。对象属性如下图所示:
资料上编写的代码如下:
Private Type s
gh As Long
xb As String * 2
xm As String * 6
gz As Single
rq As Long
End Type
Dim da As s
Private Sub Edt_Click(Index As Integer)
Select Case Index
Case 0
With da
.gh = Text1(0).Text
.xm = Text1(1).Text
.xb = IIf(Option1(0).Value, "男", "女")
.gz = Val(Text1(2).Text)
.rq = Text1(3).Text
End With
Open "worker.dat" For Random As #1 Len = Len(da)
lastrec = LOF(1) / Len(da)
put #1, lastrec + 1, da
Close #1
List1.Clear
Call Form_Activate
Text1(0).SetFocus
Case 1
recnum = List1.ListIndex + 1
Open "rec.tem" For Random As #1 Len = Len(da)
Open "worker.dat" For Random As #2 Len = Len(da)
lastrec = LOF(2) / Len(da)
For i = 1 To lastrec
If i <> recnum Then
Get #2, i, da
put #1, , da '此空白处不能加编号
End If
Next
Close #1
Close #2
Kill App.Path & "\worker.dat"
Name App.Path & "\rec.tem" As "worker.dat"
List1.Clear
Call Form_Activate
Case 2
With da
.gh = Text1(0).Text
.xm = Text1(1).Text
.xb = IIf(Option1(0).Value, "男", "女")
.gz = Text1(2).Text
.rq = Text1(3).Text
End With
Open "worker.dat" For Random As #1 Len = Len(da) put #1, List1.ListIndex + 1, da
Close #1
List1.Clear
Call Form_Activate
Case 3
List1.Clear
Call Form_Activate
End Select
End Sub
Private Sub Fnd_Click(Index As Integer)
Dim d(4) As String
Open "worker.dat" For Random As #2 Len = Len(da) lastrec = LOF(2) / Len(da)
Select Case Index
Case 0
a = Trim(InputBox("查找的姓名:", "请输入"))
If a <> "" Then
List1.Clear
For i = 1 To lastrec
Get #2, i, da
b = Trim(da.xm)
If b Like a & "*" Or b Like "*" & a Then
d(0) = da.xm
d(1) = da.gh
d(2) = da.gz
d(3) = da.xb
d(4) = da.rq
mss = d(1) & " " & d(0) & " " & d(3) & " " & d(2) & " " & d(4)
mss = Replace(mss, Chr(0), "")
List1.AddItem mss
End If
Next
If List1.ListCount < 1 Then
MsgBox "没有找到" & a
End If
End If
Case 1
Dim x As Integer, y As Integer
x = InputBox("请输入查找工资范围的下限:", "请输入")
y = InputBox("请输入查找工资范围的上限:", "请输入")
If x <= y Then
List1.Clear
For i = 1 To lastrec
Get #2, i, da
If da.gz >= x And da.gz <= y Then
d(0) = da.xm
d(1) = da.gh
d(2) = da.gz
d(3) = da.xb
d(4) = da.rq
msz = Format(d(1), "@@@@@@@@") & Format(d(0), "@@@@") & Format(d(3), "@@") & Format(d(2), "@@@@@") & Format(d(4), "@@@@@@@@")
msz = Replace(msz, Chr(0), "")
List1.AddItem msz
End If
Next
If List1.ListCount < 1 Then
MsgBox " 没有找到"
End If
End If
Case 2
a = Trim(InputBox("查找的工作证号:", "请输入"))
If a <> "" Then
List1.Clear
For i = 1 To lastrec
Get #2, i, da
b = Trim(da.gh)
If b Like a & "*" Then
d(0) = da.xm
d(1) = da.gh
d(2) = da.gz
d(3) = da.xb
d(4) = da.rq
msh = Format(d(1), "@@@@@@@@") & Format(d(0), "@@@@@@@") & Format(d(3), "@@") & Format(d(2), "@@@@@") & Format(d(4), "@@@@@@@@")
msh = Replace(msh, Chr(0), "")
List1.Clear
List1.AddItem msh
End If
Next
If List1.ListCount < 1 Then
MsgBox " 没有找到" & a
End If
End If
End Select
Close #2
End Sub
Private Sub Form_Activate()
Open App.Path & "\worker.dat" For Random As #1 Len = Len(da)
lastrec = LOF(1) / Len(da)
For i = 1 To lastrec
Get #1, i, da
gh = Format(da.gh, "@@@@@@@@")
xm = Format(da.xm, "@@@@@@@@@")
xb = Format(da.xb, "@@@@")
gz = Format(da.gz, "@@@@@@@@@@@")
rq = Format(da.rq, "@@@@@@@@@@@@@")
msg = gh & xm & xb & gz & rq
msg = Replace(msg, Chr(0), "")
List1.AddItem msg
Next
Close #1
End Sub
Private Sub List1_Click()
Open App.Path & "\worker.dat" For Random As #1 Len = Len(da)
lastrec = LOF(1) / Len(da)
For i = 1 To lastrec
If i = List1.ListIndex + 1 Then
Get #1, i, da
Text1(0).Text = da.gh
Text1(1).Text = da.xm
Text1(2).Text = da.gz
Text1(3).Text = da.rq
dd = da.xb
dd = Replace(dd, Chr(0), "")
Debug.Print dd;
If Trim(dd) = "男" Then '
Option1(0).Value = True: Option1(1).Value = False Else
Option1(1).Value = True: Option1(0).Value = False End If
End If
Next
Close #1
End Sub