3.1 系统的功能结构设计 copyright paper51.com
http://www.paper51.com 3.2 系统的数据库设计 paper51.com 1. 联系人信息表: 内容来自www.paper51.com
内容来自www.paper51.com 2.mdbnumber表: 内容来自www.paper51.com 内容来自论文无忧网 www.paper51.com 3.3 界面设计与代码设计 copyright paper51.com 1.主界面: copyright paper51.com 2. paper51.com 主界面代码分析: http://www.paper51.com '本程序是我初学VB时的作品,中文注释。 http://www.paper51.com '现在看来有很多语句没有优化,算法也一般。 内容来自www.paper51.com
'由于时间关系,我没有修改,现提供源代码, paper51.com '若有疑问,欢迎来信,我们可以共同探讨。 copyright paper51.com
Option Explicit paper51.com
Public mdbFile,mdbDataName As String 内容来自论文无忧网 www.paper51.com Public DataNumbel As Integer 内容来自论文无忧网 www.paper51.com
Public Uo As Boolean copyright paper51.com PublicListView_Name, ListView_QQ, ListView_Love As String paper51.com PublicListViewItem As Integer 内容来自论文无忧网 www.paper51.com Public Password As String 内容来自论文无忧网 www.paper51.com Private Sub TuBiao() 内容来自www.paper51.com '初始化任务栏图标 内容来自论文无忧网 www.paper51.com
Me.Move (Screen.Width - Me.Width)/ 3, (Screen.Height - Me.Height) / 3 http://www.paper51.com TrayIcon.cbSize = Len(TrayIcon) 内容来自论文无忧网 www.paper51.com TrayIcon.hwnd = Me.hwnd paper51.com
TrayIcon.uId = vbNull http://www.paper51.com
TrayIcon.uFlags = NIF_ICON Or NIF_TIP Or NIF_MESSAGE copyright paper51.com TrayIcon.ucallbackMessage =WM_MOUSEMOVE 内容来自www.paper51.com TrayIcon.hIcon = Me.Icon ' 提供任务栏图标 paper51.com TrayIcon.szTip ="Mind's Tray Icon Example" & Chr$(0) copyright paper51.com '将图标放到任务栏 内容来自www.paper51.com
Call Shell_NotifyIcon(NIM_ADD,TrayIcon) copyright paper51.com App.TaskVisible = False 内容来自论文无忧网 www.paper51.com End Sub 内容来自www.paper51.com Private SubAbout_Click() '关于版本 内容来自论文无忧网 www.paper51.com frmabout.Show vbModal copyright paper51.com
End Sub copyright paper51.com Private SubDeleteAll_Click() http://www.paper51.com Dim Result http://www.paper51.com
If Not Data1.Recordset.EOF And Not Data1.Recordset.BOF Then paper51.com Result = MsgBox("所有记录将被删除!", vbYesNo, "警告") http://www.paper51.com SetWindowPos Me.hwnd, HWND_topmost, 0, 0, 0, 0, flag '设置窗口在前 内容来自论文无忧网 www.paper51.com
If Result = vbYes Then 内容来自论文无忧网 www.paper51.com
frmData.Data1.Recordset.MoveLast copyright paper51.com frmData.Data1.Recordset.MoveFirst http://www.paper51.com Dim i As Integer 内容来自论文无忧网 www.paper51.com For i = 1 TofrmData.Data1.Recordset.RecordCount copyright paper51.com Data1.Recordset.Delete paper51.com frmData.Data1.Recordset.MoveNext copyright paper51.com
Next i 内容来自www.paper51.com Data1.Refresh 内容来自www.paper51.com
ListRefresh copyright paper51.com End If 内容来自www.paper51.com
Else 内容来自论文无忧网 www.paper51.com Result = MsgBox("无法删除记录!", vbOKOnly, "提示") paper51.com End If http://www.paper51.com SetWindowPos Me.hwnd, HWND_notopmost, 0,0, 0, 0, flag copyright paper51.com End Sub http://www.paper51.com
Private SubDocuAdd_Click() '添加记录 paper51.com
Uo = False http://www.paper51.com frmTJ.Command2.Enabled = False http://www.paper51.com
Load frmTJ http://www.paper51.com frmTJ.ShowvbModal 内容来自论文无忧网 www.paper51.com End Sub http://www.paper51.com Public SubDocuDelete_Click() '删除记录 http://www.paper51.com
Dim Result 内容来自论文无忧网 www.paper51.com If Not Data1.Recordset.EOF And Not Data1.Recordset.BOF Then 内容来自论文无忧网 www.paper51.com IffrmData.ListView1.ListItems.Count > 0 Then copyright paper51.com
IfListView1.SelectedItem.Index > 0 Then paper51.com Result = MsgBox("当前记录将被删除!", vbYesNo, "警告") paper51.com SetWindowPos Me.hwnd, HWND_topmost, 0, 0, 0, 0, flag '设置窗口在前 paper51.com
If Result = vbYes Then 内容来自论文无忧网 www.paper51.com Data1.Recordset.Delete copyright paper51.com Data1.Refresh paper51.com ListRefresh copyright paper51.com
End If paper51.com Else 内容来自www.paper51.com Result = MsgBox("请选择要删除的记录!", vbOKOnly, "警告") copyright paper51.com SetWindowPos Me.hwnd,HWND_topmost, 0, 0, 0, 0, flag '设置窗口在前 paper51.com
End If paper51.com End If paper51.com Else http://www.paper51.com Result = MsgBox("无法删除当前记录!", vbOKOnly, "提示") copyright paper51.com End If 内容来自论文无忧网 www.paper51.com
SetWindowPos Me.hwnd, HWND_notopmost, 0,0, 0, 0, flag 内容来自www.paper51.com ' ListRefresh copyright paper51.com End Sub copyright paper51.com Private SubDocuExit_Click() '退出程序 http://www.paper51.com Unload frmData 内容来自www.paper51.com End Sub copyright paper51.com Private SubDocuSeek_Click() '查询记录 paper51.com numRem_Click copyright paper51.com Load frmCX 内容来自论文无忧网 www.paper51.com frmCX.ShowvbModal 内容来自www.paper51.com
End Sub 内容来自www.paper51.com
Private Sub Form_Resize() copyright paper51.com If WindowState = 1 Then Me.Visible =False 内容来自论文无忧网 www.paper51.com End Sub copyright paper51.com
Private SubForm_Load() '程序初始化 内容来自www.paper51.com If App.PrevInstance Then copyright paper51.com
Dim Recut As Integer http://www.paper51.com Recut = MsgBox("程序已经运行,请检查窗口是否已被最小化!", 48, "提示") http://www.paper51.com Unload Me 内容来自www.paper51.com Exit Sub http://www.paper51.com End If http://www.paper51.com ListViewStyle_Click '使ListView控件可以整行选择 内容来自www.paper51.com
ListViewStyleBiaoG_Click '使ListView控件有表格风格 内容来自www.paper51.com
ListViewStyleOne_Click '允许单击选择 内容来自www.paper51.com ListViewStyleTwo_Click '允许双击选择 paper51.com
Frm_Load 内容来自论文无忧网 www.paper51.com TuBiao 内容来自论文无忧网 www.paper51.com ' SetWindowPos Me.hwnd, HWND_topmost, 0,0, 0, 0, flag '设置窗口在前 内容来自www.paper51.com Dim i As String http://www.paper51.com Dim j AsInteger copyright paper51.com '开始初始化 内容来自www.paper51.com For j = 0 To 13 内容来自论文无忧网 www.paper51.com Text1(j).Text= "" 内容来自www.paper51.com Next j 内容来自www.paper51.com End Sub copyright paper51.com Private SubnumMPgl_Click() 内容来自论文无忧网 www.paper51.com
On Error GoTo ErrHandle 内容来自www.paper51.com frmData.Caption = "信息管理 -- " & mdbFile & "[" &mdbDataName & "]" 内容来自www.paper51.com '设置字符串变量来调用SQL语句 paper51.com SQLoriginal = "select * from "& frmData.mdbDataName '"Data" http://www.paper51.com SQLadd = " where Name=Name" paper51.com SQLorder = "" 内容来自www.paper51.com
Data1.DatabaseName = mdbFile'"\MyNote.mdb" 内容来自论文无忧网 www.paper51.com Data1.RecordSource = SQLoriginal + SQLadd+ SQLorder paper51.com
Data1.Refresh 内容来自www.paper51.com ListRefresh 内容来自www.paper51.com
Exit Sub http://www.paper51.com '错误处理 paper51.com ErrHandle: paper51.com MsgBox Err.Description 内容来自论文无忧网 www.paper51.com End Sub 内容来自www.paper51.com Private SubListView1_Click() 内容来自论文无忧网 www.paper51.com IfListView1.ListItems.Count > 0 Then copyright paper51.com Dim i, Count AsInteger paper51.com Count = ListView1.SelectedItem.Index copyright paper51.com
Data1.Recordset.MoveFirst 内容来自www.paper51.com
i = 1 copyright paper51.com
Do While i < Count copyright paper51.com Data1.Recordset.MoveNext http://www.paper51.com i = i + 1 内容来自论文无忧网 www.paper51.com Loop 内容来自论文无忧网 www.paper51.com '("Name") 内容来自论文无忧网 www.paper51.com '("Oicq") paper51.com ListViewItem = Count 内容来自www.paper51.com
frmData.Text1(0).Text= frmData.Data1.Recordset.Fields("Sex") 'lPassword(frmData.Data1.Recordset.Fields("Sex")) 内容来自论文无忧网 www.paper51.com
frmData.Text1(1).Text= frmData.Data1.Recordset.Fields("Age") 'lPassword(frmData.Data1.Recordset.Fields("Year")) 内容来自论文无忧网 www.paper51.com 'Age年龄 paper51.com frmData.Text1(2).Text= frmData.Data1.Recordset.Fields("Year")'lPassword(frmData.Data1.Recordset.Fields("Constell")) copyright paper51.com
frmData.Text1(3).Text= frmData.Data1.Recordset.Fields("Constell") http://www.paper51.com frmData.Text1(4).Text= frmData.Data1.Recordset.Fields("Attributive") copyright paper51.com frmData.Text1(5).Text= frmData.Data1.Recordset.Fields("Blood")'lPassword(frmData.Data1.Recordset.Fields("Address")) copyright paper51.com
内容来自论文无忧网 www.paper51.com frmData.Text1(6).Text= frmData.Data1.Recordset.Fields("Address")'lPassword(frmData.Data1.Recordset.Fields("Address")) copyright paper51.com frmData.Text1(7).Text= frmData.Data1.Recordset.Fields("TelepNo") 'lPassword(frmData.Data1.Recordset.Fields("TelepNo")) 内容来自www.paper51.com frmData.Text1(8).Text= frmData.Data1.Recordset.Fields("MoveCall")'lPassword(frmData.Data1.Recordset.Fields("MoveCall")) paper51.com
frmData.Text1(9).Text =frmData.Data1.Recordset.Fields("Home")'lPassword(frmData.Data1.Recordset.Fields("Home")) 内容来自www.paper51.com frmData.Text1(10).Text= frmData.Data1.Recordset.Fields("Call")'lPassword(frmData.Data1.Recordset.Fields("Call")) http://www.paper51.com
frmData.Text1(11).Text= frmData.Data1.Recordset.Fields("Fax")'lPassword(frmData.Data1.Recordset.Fields("Fax")) http://www.paper51.com frmData.Text1(12).Text= frmData.Data1.Recordset.Fields("Email") 'lPassword(frmData.Data1.Recordset.Fields("Email")) http://www.paper51.com frmData.Text1(13).Text= frmData.Data1.Recordset.Fields("Appendix")'lPassword(frmData.Data1.Recordset.Fields("Appendix")) 内容来自www.paper51.com End If 内容来自论文无忧网 www.paper51.com End Sub paper51.com Private SubListView1_DblClick() '双击修改 paper51.com ListView1_Click copyright paper51.com
numUo_Click http://www.paper51.com End Sub 内容来自www.paper51.com Private SubListView1_ItemClick(ByVal Item As ComctlLib.ListItem) 内容来自论文无忧网 www.paper51.com '--------------------- copyright paper51.com ListView1_Click http://www.paper51.com End Sub http://www.paper51.com
Private SubmdbFileData_Click(Index As Integer) 内容来自论文无忧网 www.paper51.com mdbDataName= "Data" & CStr(Index) paper51.com numMPgl_Click 内容来自www.paper51.com
End Sub copyright paper51.com
Private SubnumAcess_Click() '新建数据库 内容来自论文无忧网 www.paper51.com mdbFile =DialogFile(Me.hwnd, 0, "新建数据库记录", "MyData","Access(*.mdb)" & Chr(0) & "*.mdb" & Chr(0)& "All files(*.*)" & Chr(0) & "*.*", App.Path,"mdb") 内容来自论文无忧网 www.paper51.com
If mdbFile ="" Then Exit Sub copyright paper51.com DataNumbel = 0 http://www.paper51.com New_click '新建数据库 内容来自www.paper51.com
nummdbData_Click 内容来自www.paper51.com Dim i As Integer 内容来自www.paper51.com For i = 2 To 5 copyright paper51.com mdbFileData(i).Visible = False paper51.com Next i 内容来自www.paper51.com DocuManage.Visible= True paper51.com DocuInquir.Visible= True http://www.paper51.com numOption.Visible= True 内容来自论文无忧网 www.paper51.com End Sub 内容来自www.paper51.com Private SubnummdbData_Click() '新建数据表 copyright paper51.com cmdCreate_Click http://www.paper51.com AddNumbel '修改数据表记录 paper51.com ReadNumbel '读数据表记录 http://www.paper51.com numData.Enabled =True 内容来自www.paper51.com
numMPgl_Click 内容来自www.paper51.com End Sub 内容来自论文无忧网 www.paper51.com Private SubnumOpen_Click() copyright paper51.com On Error GoToErrHandle paper51.com mdbFile =DialogFile(Me.hwnd, 1, "打开数据库记录", "","Access(*.mdb)" & Chr(0) & "*.mdb" & Chr(0)& "All files(*.*)" & Chr(0) & "*.*", App.Path,"mdb") paper51.com If mdbFile ="" Then Exit Sub http://www.paper51.com nummdbData.Enabled= True paper51.com Dim i As Integer paper51.com For i = 2 To 5 内容来自www.paper51.com mdbFileData(i).Visible = False copyright paper51.com Next i copyright paper51.com
DocuManage.Visible= True copyright paper51.com
DocuInquir.Visible= True http://www.paper51.com numOption.Visible= True copyright paper51.com frmLogin.Show vbModal http://www.paper51.com If NoLogin = TrueThen End copyright paper51.com ReadNumbel 内容来自www.paper51.com mdbDataName = "data1" 内容来自论文无忧网 www.paper51.com numMPgl_Click 内容来自论文无忧网 www.paper51.com Exit Sub 内容来自论文无忧网 www.paper51.com ErrHandle: ExitSub http://www.paper51.com End Sub 内容来自www.paper51.com
内容来自论文无忧网 www.paper51.com
|