📄 frm_taiqu.frm
字号:
EndProperty
End
Begin Windows_XP.xpcmdbutton xpcmdbutton11
Height = 375
Left = 3840
TabIndex = 10
Top = 1080
Width = 975
_ExtentX = 1720
_ExtentY = 661
Caption = "添加"
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
End
Begin Windows_XP.xpcmdbutton xpcmdbutton21
Height = 375
Left = -71760
TabIndex = 11
Top = 1080
Width = 975
_ExtentX = 1720
_ExtentY = 661
Caption = "修改"
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
End
Begin VB.Label Label8
Caption = "台区名称:"
Height = 255
Left = -74760
TabIndex = 17
Top = 1200
Width = 975
End
Begin VB.Label Label7
Caption = "台区编号:"
Height = 255
Left = -74760
TabIndex = 16
Top = 720
Width = 975
End
Begin VB.Label Label5
Caption = "台区名称:"
Height = 255
Left = -74760
TabIndex = 15
Top = 1200
Width = 975
End
Begin VB.Label Label4
Caption = "台区编号:"
Height = 255
Left = -74760
TabIndex = 14
Top = 720
Width = 975
End
Begin VB.Label Label2
Caption = "台区名称:"
Height = 255
Left = 360
TabIndex = 13
Top = 1200
Width = 1335
End
Begin VB.Label Label1
Caption = "台区编号:"
Height = 255
Left = 360
TabIndex = 12
Top = 600
Width = 975
End
End
Begin VB.Label Label3
BackStyle = 0 'Transparent
Caption = "设置台区"
ForeColor = &H00FF0000&
Height = 255
Left = 0
TabIndex = 0
Top = 0
Width = 1335
End
End
Attribute VB_Name = "frm_taiqu"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Private Sub Form_Load()
Dim i As Integer
Dim strsql As String
With MSHFlexGrid1
For i = 0 To 2
.ColWidth(i) = Me.MSHFlexGrid1.Width / 2
Next i
End With
strsql = "select * from taiqu"
openrs strsql
Set Me.MSHFlexGrid1.DataSource = rs
clors
With MSHFlexGrid1
.TextMatrix(0, 0) = "台区编号"
.TextMatrix(0, 1) = "台区名称"
End With
End Sub
Private Sub xpcmdbutton1_Click() '添加
Dim strsql As String
If Trim(txt_id.Text) = "" Then
MsgBox ("台区编号不能为空"), vbOKOnly + vbInformation, "提示"
Exit Sub
End If
strsql = "select * from taiqu"
openrs strsql
Do Until rs.EOF
If rs.Fields("taiqu_id").Value = txt_id.Text Then
MsgBox ("已经存在该台区编号!"), vbOKOnly + vbInformation, "提示"
clors
Exit Sub
End If
rs.MoveNext
Loop
rs.AddNew
rs.Fields("taiqu_id").Value = txt_id.Text
rs.Fields("taiqu_name").Value = Trim(txt_name.Text)
rs.UpdateBatch
clors
MsgBox ("台区添加成功!"), vbOKOnly + vbInformation, "提示"
strsql = "select * from taiqu"
openrs strsql
Set Me.MSHFlexGrid1.DataSource = rs
clors
With MSHFlexGrid1
.TextMatrix(0, 0) = "台区编号"
.TextMatrix(0, 1) = "台区名称"
End With
End Sub
Private Sub xpcmdbutton2_Click() '修改(此种做法可以修改台区编号)
Dim strsql As String
If Trim(txt_idupdata.Text) = "" Then
MsgBox ("台区编号不能为空"), vbOKOnly + vbInformation, "提示"
Exit Sub
End If
strsql = "select * from taiqu where taiqu_id='" & Trim(txt_idupdata.Text) & "'"
openrs strsql
If rs.EOF Then
MsgBox ("不存在该台区编号!"), vbOKOnly + vbInformation, "提示"
clors
Exit Sub
End If
rs.Delete
rs.UpdateBatch
strsql = "select * from taiqu "
openrs strsql
Do Until rs.EOF
If rs.Fields("taiqu_id").Value = txt_idupdata.Text Then
MsgBox ("已经存在该台区编号!"), vbOKOnly + vbInformation, "提示"
clors
Exit Sub
End If
rs.MoveNext
Loop
rs.AddNew
rs.Fields("taiqu_id").Value = txt_idupdata.Text
rs.Fields("taiqu_name").Value = Trim(txt_nameupdata.Text)
rs.UpdateBatch
clors
MsgBox ("台区修该成功!"), vbOKOnly + vbInformation, "提示"
strsql = "select * from taiqu"
openrs strsql
Set Me.MSHFlexGrid1.DataSource = rs
clors
With MSHFlexGrid1
.TextMatrix(0, 0) = "台区编号"
.TextMatrix(0, 1) = "台区名称"
End With
End Sub
Private Sub xpcmdbutton3_Click() '查询(修该)
Dim strsql As String
If Trim(txt_idupdata.Text) = "" Then
MsgBox ("台区编号不能为空"), vbOKOnly + vbInformation, "提示"
Exit Sub
End If
strsql = "select * from taiqu where taiqu_id='" & Trim(txt_idupdata.Text) & "'"
openrs strsql
If rs.EOF Then
MsgBox ("不存在该台区编号!"), vbOKOnly + vbInformation, "提示"
clors
Exit Sub
End If
txt_nameupdata.Text = rs.Fields("taiqu_name").Value
clors
strsql = "select * from taiqu"
openrs strsql
Set Me.MSHFlexGrid1.DataSource = rs
clors
With MSHFlexGrid1
.TextMatrix(0, 0) = "台区编号"
.TextMatrix(0, 1) = "台区名称"
End With
End Sub
Private Sub xpcmdbutton4_Click() '删除
Dim strsql As String
If Trim(txt_iddel.Text) = "" Then
MsgBox ("台区编号不能为空"), vbOKOnly + vbInformation, "提示"
Exit Sub
End If
strsql = "select * from taiqu where taiqu_id='" & Trim(txt_iddel.Text) & "'"
openrs strsql
If rs.EOF Then
MsgBox ("不存在该台区编号!"), vbOKOnly + vbInformation, "提示"
clors
Exit Sub
End If
rs.Delete
rs.UpdateBatch
MsgBox ("台区已经成功删除"), vbOKOnly + vbInformation, "提示"
strsql = "select * from taiqu"
openrs strsql
Set Me.MSHFlexGrid1.DataSource = rs
clors
With MSHFlexGrid1
.TextMatrix(0, 0) = "台区编号"
.TextMatrix(0, 1) = "台区名称"
End With
End Sub
Private Sub xpcmdbutton5_Click() '查询(删除)
Dim strsql As String
If Trim(txt_iddel.Text) = "" Then
MsgBox ("台区编号不能为空"), vbOKOnly + vbInformation, "提示"
Exit Sub
End If
strsql = "select * from taiqu where taiqu_id='" & Trim(txt_iddel.Text) & "'"
openrs strsql
If rs.EOF Then
MsgBox ("不存在该台区编号!"), vbOKOnly + vbInformation, "提示"
clors
Exit Sub
End If
txt_namedel.Text = rs.Fields("taiqu_name").Value
clors
strsql = "select * from taiqu"
openrs strsql
Set Me.MSHFlexGrid1.DataSource = rs
clors
With MSHFlexGrid1
.TextMatrix(0, 0) = "台区编号"
.TextMatrix(0, 1) = "台区名称"
End With
End Sub
Private Sub xpcmdbutton6_Click() '查询(舔加)
Dim strsql As String
If Trim(txt_id.Text) = "" Then
MsgBox ("台区编号不能为空"), vbOKOnly + vbInformation, "提示"
Exit Sub
End If
strsql = "select * from taiqu where taiqu_id='" & Trim(txt_id.Text) & "'"
openrs strsql
If rs.EOF Then
MsgBox ("不存在该台区编号!"), vbOKOnly + vbInformation, "提示"
clors
Exit Sub
End If
txt_name.Text = rs.Fields("taiqu_name").Value
clors
strsql = "select * from taiqu"
openrs strsql
Set Me.MSHFlexGrid1.DataSource = rs
clors
With MSHFlexGrid1
.TextMatrix(0, 0) = "台区编号"
.TextMatrix(0, 1) = "台区名称"
End With
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -