📄 frmprovince.frm
字号:
VERSION 5.00
Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "mscomctl.ocx"
Begin VB.Form frmProvince
BackColor = &H00C0E0FF&
BorderStyle = 1 'Fixed Single
Caption = "供应商省份设置"
ClientHeight = 4440
ClientLeft = 45
ClientTop = 435
ClientWidth = 6045
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 4440
ScaleWidth = 6045
StartUpPosition = 2 'CenterScreen
Begin MSComctlLib.ImageList ImageList1
Left = 3000
Top = 120
_ExtentX = 1005
_ExtentY = 1005
BackColor = -2147483643
ImageWidth = 16
ImageHeight = 16
MaskColor = 12632256
_Version = 393216
BeginProperty Images {2C247F25-8591-11D1-B16A-00C0F0283628}
NumListImages = 1
BeginProperty ListImage1 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "frmProvince.frx":0000
Key = ""
EndProperty
EndProperty
End
Begin VB.CommandButton cmdAdd
Caption = "添加"
Height = 375
Left = 840
TabIndex = 5
Top = 2280
Width = 2415
End
Begin VB.CommandButton cmdDel
Caption = "删除"
Height = 375
Left = 840
TabIndex = 4
Top = 2880
Width = 2415
End
Begin VB.CommandButton cmdExit
Caption = "关闭"
Height = 375
Left = 840
TabIndex = 3
Top = 3480
Width = 2415
End
Begin VB.CommandButton cmdAll
Caption = "全部显示"
Height = 375
Left = 840
TabIndex = 2
Top = 1680
Width = 2415
End
Begin VB.TextBox Text1
Alignment = 2 'Center
Height = 495
Left = 840
TabIndex = 0
Top = 720
Width = 2415
End
Begin MSComctlLib.ListView ListView1
Height = 3615
Left = 3720
TabIndex = 6
Top = 600
Width = 2055
_ExtentX = 3625
_ExtentY = 6376
View = 2
LabelEdit = 1
LabelWrap = -1 'True
HideSelection = -1 'True
_Version = 393217
Icons = "ImageList1"
SmallIcons = "ImageList1"
ColHdrIcons = "ImageList1"
ForeColor = -2147483640
BackColor = -2147483643
BorderStyle = 1
Appearance = 1
NumItems = 1
BeginProperty ColumnHeader(1) {BDD1F052-858B-11D1-B16A-00C0F0283628}
Text = "省名"
Object.Width = 3616
EndProperty
End
Begin VB.Label Label1
Alignment = 2 'Center
BackStyle = 0 'Transparent
Caption = "输入*"
Height = 255
Left = 120
TabIndex = 1
Top = 840
Width = 615
End
End
Attribute VB_Name = "frmProvince"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim Sql As String
Dim RS As ADODB.Recordset
Dim ltmW As ListItem
Private Sub cmdAdd_Click()
'添加
If Trim(Me.Text1.Text) <> "" Then
Sql = "select * from 省份表 where 省名='" & Trim(Me.Text1.Text) & "'"
Set RS = dbSelect(Sql)
If RS.EOF Then
Sql = "insert into 省份表 values('" & Trim(Me.Text1.Text) & "')"
Set ltmW = Me.ListView1.ListItems.Add
ltmW.Text = Trim(Me.Text1.Text)
ltmW.Icon = 1
ltmW.SmallIcon = 1
dbOperate Sql
Else
MsgBox "库中已有!"
End If
Else
MsgBox "主键不能为空!"
End If
End Sub
Private Sub cmdAll_Click()
'全部显示
Me.ListView1.ListItems.Clear
Sql = "select * from 省份表"
Set RS = dbSelect(Sql)
While Not RS.EOF
Set ltmW = Me.ListView1.ListItems.Add
ltmW.Text = RS.Fields(0)
ltmW.Icon = 1
ltmW.SmallIcon = 1
RS.MoveNext
Wend
End Sub
Private Sub cmdDel_Click()
'删除
Dim i As Integer, bln As Boolean
If Trim(Me.Text1.Text) <> "" Then
Sql = "select * from 省份表 where 省名='" & Trim(Me.Text1.Text) & "'"
Set RS = dbSelect(Sql)
If Not RS.EOF Then
For i = 1 To Me.ListView1.ListItems.Count
If Me.ListView1.ListItems(i).Text = Trim(Me.Text1.Text) Then
bln = True
Exit For
End If
Next i
If bln = True Then
Me.ListView1.ListItems.Remove (i)
Sql = "delete from 省份表 where 省名='" & Trim(Me.Text1.Text) & "'"
Me.Text1.Text = ""
dbOperate Sql
End If
Else
MsgBox "库中无此数据!"
End If
Else
MsgBox "主键不能为空!"
End If
End Sub
Private Sub cmdExit_Click()
'退出
Unload Me
End Sub
Private Sub ListView1_ItemClick(ByVal Item As MSComctlLib.ListItem)
'显示
Me.Text1.Text = Item.Text
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -