📄 form1.vb
字号:
'
'tblPre
'
Me.tblPre.ImageIndex = 6
Me.tblPre.ToolTipText = "上一条"
'
'tblNext
'
Me.tblNext.ImageIndex = 7
Me.tblNext.ToolTipText = "下一条"
'
'tblLine4
'
Me.tblLine4.Style = System.Windows.Forms.ToolBarButtonStyle.Separator
'
'tblSave
'
Me.tblSave.ImageIndex = 10
Me.tblSave.ToolTipText = "保存更改"
'
'tblFind
'
Me.tblFind.ImageIndex = 8
Me.tblFind.ToolTipText = "查看"
'
'tblLine5
'
Me.tblLine5.Style = System.Windows.Forms.ToolBarButtonStyle.Separator
'
'tblHelp
'
Me.tblHelp.ImageIndex = 13
Me.tblHelp.ToolTipText = "帮助"
'
'tblExit
'
Me.tblExit.ImageIndex = 11
Me.tblExit.ToolTipText = "退出"
'
'ImageList1
'
Me.ImageList1.ImageSize = New System.Drawing.Size(16, 16)
Me.ImageList1.ImageStream = CType(resources.GetObject("ImageList1.ImageStream"), System.Windows.Forms.ImageListStreamer)
Me.ImageList1.TransparentColor = System.Drawing.Color.Transparent
'
'Label8
'
Me.Label8.Location = New System.Drawing.Point(184, 184)
Me.Label8.Name = "Label8"
Me.Label8.Size = New System.Drawing.Size(40, 16)
Me.Label8.TabIndex = 27
Me.Label8.Text = "性别"
'
'txtSex
'
Me.txtSex.Location = New System.Drawing.Point(216, 184)
Me.txtSex.Name = "txtSex"
Me.txtSex.Size = New System.Drawing.Size(112, 21)
Me.txtSex.TabIndex = 28
Me.txtSex.Text = "TextBox1"
'
'Label9
'
Me.Label9.Location = New System.Drawing.Point(8, 208)
Me.Label9.Name = "Label9"
Me.Label9.Size = New System.Drawing.Size(56, 16)
Me.Label9.TabIndex = 29
Me.Label9.Text = "工作单位"
'
'txtCompany
'
Me.txtCompany.Location = New System.Drawing.Point(64, 208)
Me.txtCompany.Name = "txtCompany"
Me.txtCompany.Size = New System.Drawing.Size(320, 21)
Me.txtCompany.TabIndex = 30
Me.txtCompany.Text = "TextBox1"
'
'Sta
'
Me.Sta.Location = New System.Drawing.Point(0, 363)
Me.Sta.Name = "Sta"
Me.Sta.Panels.AddRange(New System.Windows.Forms.StatusBarPanel() {Me.Sta1, Me.Sta2, Me.Sta3})
Me.Sta.ShowPanels = True
Me.Sta.Size = New System.Drawing.Size(386, 24)
Me.Sta.TabIndex = 31
'
'Sta1
'
Me.Sta1.Icon = CType(resources.GetObject("Sta1.Icon"), System.Drawing.Icon)
Me.Sta1.Text = "准备就绪"
'
'Sta2
'
Me.Sta2.AutoSize = System.Windows.Forms.StatusBarPanelAutoSize.Spring
Me.Sta2.Width = 135
'
'Sta3
'
Me.Sta3.AutoSize = System.Windows.Forms.StatusBarPanelAutoSize.Spring
Me.Sta3.Width = 135
'
'txtQQ
'
Me.txtQQ.Location = New System.Drawing.Point(64, 336)
Me.txtQQ.Name = "txtQQ"
Me.txtQQ.Size = New System.Drawing.Size(320, 21)
Me.txtQQ.TabIndex = 32
Me.txtQQ.Text = "TextBox1"
'
'Label10
'
Me.Label10.Location = New System.Drawing.Point(8, 336)
Me.Label10.Name = "Label10"
Me.Label10.Size = New System.Drawing.Size(48, 16)
Me.Label10.TabIndex = 33
Me.Label10.Text = "QQ号码"
'
'Form1
'
Me.AutoScaleBaseSize = New System.Drawing.Size(6, 14)
Me.BackColor = System.Drawing.SystemColors.ControlLight
Me.ClientSize = New System.Drawing.Size(386, 387)
Me.Controls.Add(Me.Label10)
Me.Controls.Add(Me.txtQQ)
Me.Controls.Add(Me.Sta)
Me.Controls.Add(Me.txtCompany)
Me.Controls.Add(Me.Label9)
Me.Controls.Add(Me.txtSex)
Me.Controls.Add(Me.Label8)
Me.Controls.Add(Me.ToolBar1)
Me.Controls.Add(Me.btnInsertOk)
Me.Controls.Add(Me.btnNext)
Me.Controls.Add(Me.btnPre)
Me.Controls.Add(Me.Label7)
Me.Controls.Add(Me.txtEmail)
Me.Controls.Add(Me.Label6)
Me.Controls.Add(Me.txtmovebal)
Me.Controls.Add(Me.btnFind)
Me.Controls.Add(Me.btnInsert)
Me.Controls.Add(Me.btnAddOk)
Me.Controls.Add(Me.btnAdd)
Me.Controls.Add(Me.btnClear)
Me.Controls.Add(Me.Label5)
Me.Controls.Add(Me.txtbirthday)
Me.Controls.Add(Me.txtage)
Me.Controls.Add(Me.txtaddress)
Me.Controls.Add(Me.txtTel)
Me.Controls.Add(Me.txtName)
Me.Controls.Add(Me.Label4)
Me.Controls.Add(Me.Label3)
Me.Controls.Add(Me.Label2)
Me.Controls.Add(Me.Label1)
Me.Controls.Add(Me.ListBox1)
Me.ForeColor = System.Drawing.SystemColors.ControlText
Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog
Me.Icon = CType(resources.GetObject("$this.Icon"), System.Drawing.Icon)
Me.MaximizeBox = False
Me.Menu = Me.MainMenu1
Me.Name = "Form1"
Me.Text = "通讯录"
CType(Me.Sta1, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.Sta2, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.Sta3, System.ComponentModel.ISupportInitialize).EndInit()
Me.ResumeLayout(False)
End Sub
#End Region
'//*************************************************************************
Public Shared _customers As New ArrayList '//定义集合保存记录
Public intcount As Integer '//查询变量保存索引
Public Shared _name As String '//保存登录者的名称
'Dim _form As New Form3
Public Shared ischange As Boolean '//判断记录是否改变
Public Shared infofile As String '//保存配置信息
'//*************************************************************
'//欲在其他窗体使用变量,必须声明为共享 (Shared)
'//************************************************************
'Public Property GetSetcount()
'public _intcount as integer
' Get
' Return intcount
'End Get
'Set(ByVal Value)
' intcount = Value
'End Set
'End Property
<Serializable()> Public Structure Custom '//构建结构
Public name As String
Public birthday As String '//添加属性成员
Public age As Integer
Public email As String
Public tel As String
Public movebal As String
Public address As String
Public sex As String
Public company As String
Public qq As String
Public Overrides Function ToString() As String
Return name '//用于向列表中添加名称
End Function
Public Function isEmpty() As Boolean
'//判断是否为空
If name = "" Then
Return True
Else
Return False
End If
End Function
End Structure
Public ReadOnly Property selectedcustomer() As Custom
'//判断是否有项目被选中
Get
If ListBox1.SelectedIndex <> -1 Then
'Return ListBox1.Items(ListBox1.SelectedIndex)
Return _customers(ListBox1.SelectedIndex)
End If
End Get
End Property
Public Class custromCollection '//构建集合custromCollection
Inherits System.Collections.CollectionBase '//继承于CollectionBase
Private telhashtable As New Hashtable '//构建散列表进行查询
Private namehashtable As New Hashtable
Public ReadOnly Property name_hashtable() As Hashtable
Get
Return namehashtable '//返回名字集合项
End Get
End Property
Public ReadOnly Property tel_hashtable() As Hashtable
Get
Return telhashtable
End Get
End Property
Public Sub add(ByVal newcustom As Custom)
Me.List.Add(newcustom)
tel_hashtable.Add(newcustom.tel.ToLower, newcustom)
name_hashtable.Add(newcustom.name.ToLower, newcustom)
End Sub
Default Public ReadOnly Property item(ByVal email As String) As Custom
Get
'Return Me.List.Item(index)
'if
Return tel_hashtable.Item(email.ToLower)
Return name_hashtable.Item(email.ToLower)
End Get
'Set(ByVal Value As Custom)
'Me.List.Item(index) = Value
'End Set
End Property
Public Sub _Clear()
MyBase.Clear()
tel_hashtable.Clear()
name_hashtable.Clear()
End Sub
Public Sub remove(ByVal removecustom As Custom)
Me.List.Remove(removecustom)
tel_hashtable.Remove(removecustom.tel.ToLower)
name_hashtable.Remove(removecustom.name.ToLower)
End Sub
Public Sub _removeat(ByVal index As Integer)
remove(item(index))
End Sub
End Class
Public Function CreatCustom(ByVal name As String, ByVal tel As String, ByVal movebal As String, ByVal email As String, ByVal address As String, _
ByVal age As Integer, ByVal birthday As String, ByVal sex As String, ByVal company As String, ByVal qq As String)
'//添加操作
Dim newcustom As Custom
newcustom.name = name
newcustom.tel = tel
newcustom.movebal = movebal
newcustom.email = email
newcustom.address = address
newcustom.age = age
newcustom.birthday = birthday
newcustom.sex = sex
newcustom.company = company
newcustom.qq = qq
_customers.Add(newcustom)
' custromCollection.add(newcustom) '//查询
'ListBox1.Items.Add(newcustom.name)
ListBox1.Items.Add(newcustom.name)
'showCustom(newcustom)
Return newcustom
End Function
Public Function FirstCreatCustom(ByVal name As String, ByVal tel As String, ByVal movebal As String, ByVal email As String, ByVal address As String, _
ByVal age As Integer, ByVal birthday As String, ByVal sex As String, ByVal company As String, ByVal qq As String, ByVal intposion As Integer)
'//初始化载入文件,创建列表
Dim newcustom As Custom
newcustom.name = name
newcustom.tel = tel
newcustom.movebal = movebal
newcustom.email = email
newcustom.address = address
newcustom.age = age
newcustom.birthday = birthday
newcustom.sex = sex
newcustom.company = company
newcustom.qq = qq
_customers.Insert(intposion, newcustom)
' custromCollection.add(newcustom) '//查询
'ListBox1.Items.Add(newcustom.name)
ListBox1.Items.Insert(intposion, newcustom.name)
'showCustom(newcustom)
Return newcustom
End Function
Public Function _CreatCustom(ByVal name As String, ByVal tel As String, ByVal movebal As String, ByVal email As String, ByVal address As String, _
ByVal age As Integer, ByVal birthday As String, ByVal sex As String, ByVal company As String, ByVal qq As String)
'//插入操作
Dim newcustom As Custom
newcustom.name = name
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -