请高手做一道VB编程题

来源:百度知道 编辑:UC知道 时间:2024/09/23 01:22:48
假定在磁盘上已建立了一个通信录文件,文件中的每个记录包括编号,用户名,电话号码和地址等4项内容。试编写一个程序,用自己选择的检索方法(如二分法)从文件中查找指定的用户的编号,并在文本框中输出其名字,电话号码和地址。

Private Declare Function WritePrivateProfileString Lib "kernel32" Alias "WritePrivateProfileStringA" (ByVal lpApplicationName As String, ByVal lpKeyName As Any, ByVal lpString As Any, ByVal lpFileName As String) As Long '保存

Private Sub Command1_Click() '保存
Dim success As Long
success = WritePrivateProfileString("组名", "地方", Text1.Text, "c:\aa.ini")
End Sub
'=======================================
Private Declare Function GetPrivateProfileString Lib "kernel32" Alias "GetPrivateProfileStringA" (ByVal lpApplicationName As String, ByVal lpKeyName As Any, ByVal lpDefault As String, ByVal lpReturnedString As String, ByVal nSize As Long, ByVal lpFileName As String) As Long '读

Private Sub Form_load()'读
Dim ret As Long
Dim buff As String
buff = String(255, 0)
ret = GetPrivateProfileString("组名", "地方", "",