📄 form1.frm
字号:
Text27.Text = Trim(Adodc3.Recordset.Fields("Add_Remark").Value)
'Combo1.Text = Trim(Adodc3.Recordset.Fields("Sex").Value)
'Combo2.Text = Trim(Adodc3.Recordset.Fields("Group_Name").Value)
'Combo3.Text = Trim(Adodc3.Recordset.Fields("Blood_Type").Value)
'Combo4.Text = Trim(Adodc3.Recordset.Fields("Star").Value)
Combo5.Text = Trim(Adodc3.Recordset.Fields("Dept_Name").Value)
Combo6.Text = Trim(Adodc3.Recordset.Fields("Dept_Duty").Value)
'Combo7.Text = Trim(Adodc3.Recordset.Fields("Add_Remark").Value)
'Combo8.Text = Trim(Adodc3.Recordset.Fields("Sheng_Xiao").Value)
Combo9.Text = Trim(Adodc3.Recordset.Fields("Dept_Name").Value)
Combo10.Text = Trim(Adodc3.Recordset.Fields("Dept_Duty").Value)
Combo11.Text = Trim(Adodc3.Recordset.Fields("Belong_Industry").Value)
DTPicker1.Value = Trim(Adodc3.Recordset.Fields("Birth").Value)
strPhoto = Trim(Adodc3.Recordset.Fields("Photo").Value)
If strPhoto <> "" Then
Image1.Picture = LoadPicture(App.Path + "\photo\" + strPhoto)
Else: If strPhoto = "" Then Image1.Picture = LoadPicture(App.Path + "\photo\Nophoto.jpg")
End If
'MsgBox ("qw" + Str(Combo1.ItemData(2)))
'If (strcombo = Trim(Adodc3.Recordset.Fields("Sex").Value)) <> "" Then
'For i = 1 To Combo2.ListCount Step 1
'If Combo2.List(i) = strcombo Then
'Combo2.ListIndex = 4
'Exit For
'End If
'Next i
'End If
If strkey = "所有联系人" Or strkey = "" Then
Adodc3.RecordSource = "select * from PersonlInfo "
Else
Adodc3.RecordSource = "select distinct * from PersonlInfo where group_Name=" + "'" & strkey & "'" + "or Name=" + "'" & strkey & "'"
End If
Adodc3.Refresh
'Adodc4.CommandType = adCmdText
'Adodc4.RecordSource = "select count * from PersonlInfo "
'MsgBox ("是否要删联系人" + Combo1.List(2))
End If
End Sub
Private Sub DeleteRow_Click()
deletgoup.Show
End Sub
Private Sub EditRow_Click()
changgroup.Show
End Sub
Private Sub Form_Load()
i = 0
strkey = ""
Combo1.ListIndex = 0
Command1.Enabled = False
Command2.Enabled = False
Command3.Enabled = False
Frame1.Visible = True
Frame3.Visible = False
Frame5.Visible = False
Adodc2.Recordset.MoveFirst
While Not Adodc2.Recordset.EOF
Combo2.AddItem (Adodc2.Recordset.Fields("Group_Name"))
Adodc2.Recordset.MoveNext
Wend
Combo2.ListIndex = 0 '分组不能为空
Dim myNod As Node
Dim strall As String
strall = "所有联系人" '添加跟节点
Set myNod = TreeView1.Nodes.Add(, tvwChild, strall, strall, 4) '添加节点
Dim nodtext1 As String
Dim nodtext2 As String
Dim nodid As String
Adodc2.Refresh
Adodc2.Recordset.MoveFirst '联系组信息
While Not Adodc2.Recordset.EOF
nodtext1 = Trim(Adodc2.Recordset.Fields("Group_Name").Value)
Set myNod = TreeView1.Nodes.Add(strall, tvwChild, nodtext1, nodtext1, 1, 4)
'Adodc1.CommandType = adCmdText
Adodc1.Refresh
Adodc1.RecordSource = "select distinct Name from PersonlInfo where Group_Name=" + "'" & nodtext1 & "'"
Adodc1.CommandType = adCmdText
Adodc1.Refresh
If Adodc1.Recordset.RecordCount > 0 Then
Adodc1.Recordset.MoveFirst
While Not Adodc1.Recordset.EOF
nodtext2 = Trim(Adodc1.Recordset.Fields("Name").Value)
Set myNod = TreeView1.Nodes.Add(nodtext1, tvwChild, nodtext2, nodtext2, 1, 4)
Adodc1.Recordset.MoveNext
Wend
End If
Adodc2.Recordset.MoveNext
Wend
'DataGrid1.DataSource = Adodc3
StatusBar1.Panels(2).Text = "当前记录数" + Str(Adodc3.Recordset.RecordCount) + "条/ 记录总数" + Str(Adodc4.Recordset.RecordCount) + "条"
'Adodc1.RecordSource = "select * from PersonlInfo "
'DataGrid1.Refresh
End Sub
Private Sub Image1_Click()
CommonDialog1.DialogTitle = "选择该联系人的照片"
CommonDialog1.Filter = "所有图形文件|*.bmp;*.dib;*.gif;*.jpg;*.ico|位图文件(*.bmp;*.dib)|*.bmp;*.dib|GIF文件(*.gif)|*.gif|JPEG文件(*.jpg)|*.jpg|图标文件(*.ico)|*.ico"
CommonDialog1.ShowOpen
If CommonDialog1.FileName = "" Then Exit Sub
Image1.Picture = LoadPicture(CommonDialog1.FileName)
'mstrFileName = CommonDialog1.FileName
Exit Sub
End Sub
Private Sub Image3_Click()
CommonDialog1.DialogTitle = "选择该联系人的照片"
CommonDialog1.Filter = "所有图形文件|*.bmp;*.dib;*.gif;*.jpg;*.ico|位图文件(*.bmp;*.dib)|*.bmp;*.dib|GIF文件(*.gif)|*.gif|JPEG文件(*.jpg)|*.jpg|图标文件(*.ico)|*.ico"
CommonDialog1.ShowOpen
If CommonDialog1.FileName = "" Then Exit Sub
Image1.Picture = LoadPicture(CommonDialog1.FileName)
'mstrFileName = CommonDialog1.FileName
Exit Sub
End Sub
Private Sub Image4_Click()
If MsgBox("是否要移除照片 ?", vbYesNo + vbQuestion, "移除照片") = vbYes Then
Adodc3.Recordset.Fields("Photo").Value = ""
Adodc3.Recordset.Update
Adodc3.Refresh
Image1.Picture = LoadPicture(App.Path + "\photo\Nophoto.jpg")
End If
End Sub
Private Sub Image5_Click()
'i = Shell(App.Path + "\photo\" + Adodc3.Recordset.Fields("Photo").Value, 1)
'i = Shell(App.Path + "\photo\Nophoto.jpg", 1)
'Image1.Picture = LoadPicture(App.Path + "\photo\Nophoto.jpg")
End Sub
Private Sub RefreshRow_Click()
TreeView1.Nodes.Clear
Adodc2.Recordset.MoveFirst
While Not Adodc2.Recordset.EOF
Combo2.AddItem (Adodc2.Recordset.Fields("Group_Name"))
Adodc2.Recordset.MoveNext
Wend
Combo2.ListIndex = 0 '分组不能为空
Dim myNod As Node
Dim strall As String
strall = "所有联系人" '添加跟节点
Set myNod = TreeView1.Nodes.Add(, tvwChild, strall, strall, 4) '添加节点
Dim nodtext1 As String
Dim nodtext2 As String
Dim nodid As String
Adodc2.Refresh
Adodc2.Recordset.MoveFirst '联系组信息
While Not Adodc2.Recordset.EOF
nodtext1 = Trim(Adodc2.Recordset.Fields("Group_Name").Value)
Set myNod = TreeView1.Nodes.Add(strall, tvwChild, nodtext1, nodtext1, 1, 4)
'Adodc1.CommandType = adCmdText
Adodc1.Refresh
Adodc1.RecordSource = "select distinct Name from PersonlInfo where Group_Name=" + "'" & nodtext1 & "'"
Adodc1.CommandType = adCmdText
Adodc1.Refresh
If Adodc1.Recordset.RecordCount > 0 Then
Adodc1.Recordset.MoveFirst
While Not Adodc1.Recordset.EOF
nodtext2 = Trim(Adodc1.Recordset.Fields("Name").Value)
Set myNod = TreeView1.Nodes.Add(nodtext1, tvwChild, nodtext2, nodtext2, 1, 4)
Adodc1.Recordset.MoveNext
Wend
End If
Adodc2.Recordset.MoveNext
Wend
End Sub
Private Sub TabStrip1_Click()
Select Case TabStrip1.SelectedItem.Key
Case "ComnInfo" '常用信息
Frame1.Visible = True
Frame3.Visible = False
Frame5.Visible = False
Case "ComInfo" ' 单位信息
Frame1.Visible = False
Frame3.Visible = True
Frame5.Visible = False
Case "PersonInfo" '个人信息
Frame1.Visible = False
Frame3.Visible = False
Frame5.Visible = True
End Select
End Sub
Private Sub Text_Click()
Dim i
i = Shell("c:\\windows\system32\notepad.exe", 1)
End Sub
Private Sub Text1_Change()
Text23.Text = Text1.Text
End Sub
Private Sub Text10_Change()
Text20.Text = Text10.Text
End Sub
Private Sub Text11_Change()
Text21.Text = Text11.Text
End Sub
Private Sub Text13_Change()
Text6.Text = Text13.Text
End Sub
Private Sub Text20_Change()
Text10.Text = Text20.Text
End Sub
Private Sub Text21_Change()
Text11.Text = Text21.Text
End Sub
Private Sub Text23_Change()
Text1.Text = Text23.Text
End Sub
Private Sub Text4_Change()
strSQL = ""
strSQL = "or Name like " + "'" + Trim(Text4.Text) + "%'"
strSQL = strSQL + "or Sex like " + "'" + Trim(Text4.Text) + "%'"
strSQL = strSQL + "or Birth like " + "'" + Trim(Text4.Text) + "%'"
strSQL = strSQL + "or Sheng_Xiao like " + "'" + Trim(Text4.Text) + "%'"
strSQL = strSQL + "or Family_Tel like " + "'" + Trim(Text4.Text) + "%'"
strSQL = strSQL + "or Mobile_Tel like " + "'" + Trim(Text4.Text) + "%'"
strSQL = strSQL + "or Smart_Tel like " + "'" + Trim(Text4.Text) + "%'"
strSQL = strSQL + "or Company_Tel like " + "'" + Trim(Text4.Text) + "%'"
strSQL = strSQL + "or Family_Add like " + "'" + Trim(Text4.Text) + "%'"
strSQL = strSQL + "or Company_Add like " + "'" + Trim(Text4.Text) + "%'"
strSQL = strSQL + "or Company_Name like " + "'" + Trim(Text4.Text) + "%'"
strSQL = strSQL + "or Company_Post like " + "'" + Trim(Text4.Text) + "%'"
strSQL = strSQL + "or QQ_Num like " + "'" + Trim(Text4.Text) + "%'"
strSQL = strSQL + "or MSN_Num like " + "'" + Trim(Text4.Text) + "%'"
strSQL = strSQL + "or Per_Homepage like " + "'" + Trim(Text4.Text) + "%'"
strSQL = strSQL + "or Star like " + "'" + Trim(Text4.Text) + "%'"
strSQL = strSQL + "or Blood_Type like " + "'" + Trim(Text4.Text) + "%'"
strSQL = strSQL + "or Loving like " + "'" + Trim(Text4.Text) + "%'"
strSQL = strSQL + "or Remark like " + "'" + Trim(Text4.Text) + "%'"
strSQL = strSQL + "or Email like " + "'" + Trim(Text4.Text) + "%'"
Adodc3.RecordSource = "select distinct * from PersonlInfo where group_Name=" + "'" & Text4.Text & "'" + strSQL
Adodc3.CommandType = adCmdText
Adodc3.Refresh
'adodc3.Recordset=
End Sub
Private Sub Text6_Change()
Text13.Text = Text6.Text
End Sub
Private Sub Timer1_Timer()
StatusBar1.Panels(4).Text = Now
End Sub
Private Sub Toolbar1_ButtonClick(ByVal Button As MSComctlLib.Button)
Select Case Button.Key
Case "NewAdd" '新建联系人
Command1.Enabled = True
Command2.Enabled = False
Command3.Enabled = False
MainInfo.Text1.Text = ""
MainInfo.Text2.Text = ""
MainInfo.Text3.Text = ""
MainInfo.Text4.Text = ""
MainInfo.Text5.Text = ""
MainInfo.Text6.Text = ""
MainInfo.Text7.Text = ""
MainInfo.Text8.Text = ""
MainInfo.Text9.Text = ""
MainInfo.Text10.Text = ""
MainInfo.Text11.Text = ""
MainInfo.Text12.Text = ""
MainInfo.Text13.Text = ""
MainInfo.Text14.Text = ""
MainInfo.Text15.Text = ""
MainInfo.Text16.Text = ""
MainInfo.Text17.Text = ""
MainInfo.Text18.Text = ""
'MainInfo.Text19.Text = ""
MainInfo.Text20.Text = ""
MainInfo.Text21.Text = ""
'MainInfo.Text22.Text = ""
MainInfo.Text23.Text = ""
'MainInfo.Text24.Text = ""
MainInfo.Text25.Text = ""
MainInfo.Text26.Text = ""
Case "Change" '修改联系人
Command2.Enabled = True
Command1.Enabled = False
Command3.Enabled = False
'Text23.DataField = Adodc3.Recordset.Fields("Name")
Case "Delete" '删除联系人
Command3.Enabled = True
Command2.Enabled = False
Command1.Enabled = False
If MsgBox("是否要删联系人 " + Adodc3.Recordset.Fields("Name").Value, vbYesNo + vbQuestion, "删除联系人") = vbYes Then
Adodc3.Recordset.Delete
End If
Case "NewGroup"
addgroup.Show
Case "EditGroup"
changgroup.Show
Case "DeleteGroup"
deletgoup.Show
End Select
End Sub
Private Sub TreeView1_Click()
'adodc3 是 PersonlInfo
strkey = Trim(TreeView1.SelectedItem.Key)
If strkey = "所有联系人" Then
Adodc3.RecordSource = "select * from PersonlInfo "
Else
Adodc3.RecordSource = "select distinct * from PersonlInfo where group_Name=" + "'" & strkey & "'" + "or Name=" + "'" & strkey & "'"
End If
Adodc3.CommandType = adCmdText
Adodc3.Refresh
If Adodc3.Recordset.RecordCount > 0 Then
Adodc3.Recordset.MoveLast
Text1.Text = Trim(Adodc3.Recordset.Fields("Name").Value)
Text2.Text = Trim(Adodc3.Recordset.Fields("Mobile_Tel").Value)
Text3.Text = Trim(Adodc3.Recordset.Fields("Family_Add").Value)
'Text4.Text = Trim(Adodc3.Recordset.Fields("Name").Value)
Text5.Text = Trim(Adodc3.Recordset.Fields("Family_Tel").Value)
Text6.Text = Trim(Adodc3.Recordset.Fields("Company_Tel").Value)
Text7.Text = Trim(Adodc3.Recordset.Fields("Smart_Tel").Value)
Text8.Text = Trim(Adodc3.Recordset.Fields("QQ_Num").Value)
Text9.Text = Trim(Adodc3.Recordset.Fields("MSN_Num").Value)
Text10.Text = Trim(Adodc3.Recordset.Fields("Company_Name").Value)
Text11.Text = Trim(Adodc3.Recordset.Fields("Company_Add").Value)
Text12.Text = Trim(Adodc3.Recordset.Fields("Company_Fax").Value)
Text13.Text = Trim(Adodc3.Recordset.Fields("Company_Tel").Value) '办公电话
Text14.Text = Trim(Adodc3.Recordset.Fields("Com_Homepage").Value)
Text15.Text = Trim(Adodc3.Recordset.Fields("Company_Post").Value)
Text16.Text = Trim(Adodc3.Recordset.Fields("Email").Value)
Text17.Text = Trim(Adodc3.Recordset.Fields("Per_Homepage").Value)
Text18.Text = Trim(Adodc3.Recordset.Fields("Loving").Value)
Text19.Text = Trim(Adodc3.Recordset.Fields("Remark").Value)
Text20.Text = Trim(Adodc3.Recordset.Fields("Company_Name").Value)
Text21.Text = Trim(Adodc3.Recordset.Fields("Compan
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -