【VB开源代码栏目提醒】:以下是网学会员为您推荐的VB开源代码-FrmAreaEdit.frm,希望本篇文章对您学习有所帮助。
VERSION 5.00
Begin VB.Form FrmAreaEdit
BorderStyle = 1 'Fixed Single
Caption = "编辑地域信息"
ClientHeight = 2190
ClientLeft = 45
ClientTop = 330
ClientWidth = 3855
LinkTopic = "Form1"
LockControls = -1 'True
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 2190
ScaleWidth = 3855
StartUpPosition = 2 '屏幕中心
Begin VB.Frame Frame1
BackColor = &H80000004&
Height = 1215
Left = 240
TabIndex = 3
Top = 120
Width = 3375
Begin VB.TextBox txtArea
Height = 270
Left = 1080
MaxLength = 20
TabIndex = 0
Top = 795
Width = 2175
End
Begin VB.Label Label6
AutoSize = -1 'True
BackColor = &H00FFC0C0&
BackStyle = 0 'Transparent
Caption = "地域名称"
Height = 180
Left = 120
TabIndex = 6
Top = 840
Width = 720
End
Begin VB.Label Label2
AutoSize = -1 'True
BackColor = &H00FFC0C0&
BackStyle = 0 'Transparent
Caption = "上级地域"
Height = 180
Left = 120
TabIndex = 5
Top = 360
Width = 720
End
Begin
VB.Label lblUpper
AutoSize = -1 'True
BackColor = &H00FFC0C0&
BackStyle = 0 'Transparent
Caption = "上级地域"
Height = 180
Left = 1080
TabIndex = 4
Top = 360
Width = 720
End
End
Begin VB.CommandButton Cmd_OK
Caption = "确 定"
Default = -1 'True
Height = 400
Left = 480
MouseIcon = "FrmAreaEdit.frx":0000
MousePointer = 99 'Custom
Style = 1 'Graphical
TabIndex = 1
Top = 1560
Width = 1300
End
Begin VB.CommandButton Cmd_Cancel
Cancel = -1 'True
Caption = "取 消"
Height = 400
Left = 2085
MouseIcon = "FrmAreaEdit.frx":030A
MousePointer = 99 'Custom
Style = 1 'Graphical
TabIndex = 2
Top = 1560
Width = 1300
End
End
Attribute VB_Name = "FrmAreaEdit"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Public Modify As Boolean
Private Sub Cmd_OK_Click()
Dim TmpId As Integer
If Trim(txtArea) = "" Then
MsgBox "请输入地域名称"
Exit Sub
End If
'将用户输入的输入赋值到MyArea对象中
With MyArea
.AreaName = Trim(txtArea)
.AreaType = CurArea.AreaType + 1
.UpperId = CurArea.AreaId
If Modify = False Then '插入
If .In_DB(Trim(txtArea), .UpperId) = True Then
MsgBox Trim(txtArea) + " 已经存在"
Exit Sub
End If
TmpId = .Insert
'生成TreeView控件中新结点的关键字
Tmp_Key = Chr(Asc("a") + .AreaType)
Tmp_Key = Tmp_Key + Trim(Str(TmpId))
FrmAreaMan.TreeView1.SelectedItem.Image = 1
FrmAreaMan.TreeView1.SelectedItem.ExpandedImage = 2
FrmAreaMan.TreeView1.SelectedItem.SelectedImage = 3
Set TmpNode = FrmAreaMan.TreeView1.Nodes.Add(FrmAreaMan.TreeView1.SelectedItem.Key, _
tvwChild, Tmp_Key, .AreaName, 4, 5)
TmpNode.Selected = True
Else '修改
If CurArea.AreaName <> Trim(txtArea) Then
If .In_DB(Trim(txtArea), .UpperId) = True Then
MsgBox Trim(txtArea) + " 已经存在"
Exit Sub
End If
End If
Call .Update(CurArea.AreaId)
If CurArea.AreaName <> Trim(txtArea) Then
FrmAreaMan.TreeView1.SelectedItem.Text = Trim(txtArea)
End If
CurArea.AreaName = Trim(txtArea)
End If
End With
Unload Me
End Sub
Private Sub Cmd_Cancel_Click()
Unload Me
End Sub