📄 frmmodifystructure.frm
字号:
VERSION 5.00
Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "mscomctl.ocx"
Begin VB.Form frmModifyStructure
BorderStyle = 3 'Fixed Dialog
Caption = "维护属性数据表结构"
ClientHeight = 3825
ClientLeft = 45
ClientTop = 330
ClientWidth = 6855
Icon = "frmModifyStructure.frx":0000
LinkTopic = "Form1"
LockControls = -1 'True
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 3825
ScaleWidth = 6855
ShowInTaskbar = 0 'False
StartUpPosition = 1 'CenterOwner
Tag = "1337"
Begin VB.Frame frameEditField
Caption = "编辑"
Height = 1530
Left = 105
TabIndex = 5
Tag = "3151"
Top = 2145
Width = 5730
Begin VB.ComboBox cmbDefault
BackColor = &H8000000B&
Enabled = 0 'False
Height = 315
Left = 3825
Style = 2 'Dropdown List
TabIndex = 14
Top = 675
Width = 1620
End
Begin VB.ComboBox cmbFieldType
BackColor = &H8000000B&
Enabled = 0 'False
Height = 315
Left = 3825
Style = 2 'Dropdown List
TabIndex = 13
Top = 270
Width = 1620
End
Begin VB.CheckBox chkAllowNull
Caption = "零长度允许"
Enabled = 0 'False
Height = 270
Left = 4170
TabIndex = 12
Tag = "3170"
Top = 1170
Width = 1275
End
Begin VB.CheckBox chkRequired
Caption = "必填字段"
Enabled = 0 'False
Height = 270
Left = 1590
TabIndex = 11
Tag = "3169"
Top = 1170
Width = 1275
End
Begin VB.CheckBox chkDescending
Caption = "降序排列"
Enabled = 0 'False
Height = 270
Left = 2880
TabIndex = 10
Tag = "3168"
Top = 1170
Width = 1275
End
Begin VB.CheckBox chkAutomatic
Caption = "自动编号"
Enabled = 0 'False
Height = 270
Left = 300
TabIndex = 9
Tag = "3167"
Top = 1170
Width = 1275
End
Begin VB.TextBox txtDefault
BackColor = &H8000000B&
Enabled = 0 'False
Height = 315
Left = 3825
TabIndex = 8
Top = 675
Visible = 0 'False
Width = 1620
End
Begin VB.TextBox txtFieldLen
BackColor = &H8000000B&
Enabled = 0 'False
Height = 315
Left = 1080
TabIndex = 7
Top = 675
Width = 1620
End
Begin VB.TextBox txtFieldName
BackColor = &H8000000B&
Enabled = 0 'False
Height = 315
Left = 1065
TabIndex = 6
Top = 270
Width = 1620
End
Begin VB.Label Label4
Caption = "缺 省 值"
Height = 210
Left = 3015
TabIndex = 18
Tag = "3166"
Top = 750
Width = 795
End
Begin VB.Label Label3
Caption = "字段长度"
Height = 210
Left = 255
TabIndex = 17
Tag = "3165"
Top = 750
Width = 795
End
Begin VB.Label Label2
Caption = "字段类型"
Height = 225
Left = 3015
TabIndex = 16
Tag = "3164"
Top = 330
Width = 795
End
Begin VB.Label Label1
Caption = "字段名称"
Height = 195
Left = 225
TabIndex = 15
Tag = "3163"
Top = 345
Width = 795
End
End
Begin VB.Frame frameLayerAttribBtn
Height = 1530
Left = 5865
TabIndex = 0
Top = 2145
Width = 900
Begin VB.CommandButton btnLayerAttribCancel
Caption = "关闭(&C)"
Height = 345
Left = 60
TabIndex = 4
Tag = "3153"
Top = 1155
Width = 780
End
Begin VB.CommandButton btnLayerAttribSave
Caption = "保存(&S)"
Enabled = 0 'False
Height = 345
Left = 60
TabIndex = 3
Tag = "3046"
Top = 810
Width = 780
End
Begin VB.CommandButton btnLayerAttribDel
Caption = "删除(&D)"
Enabled = 0 'False
Height = 345
Left = 60
TabIndex = 2
Tag = "3148"
Top = 465
Width = 780
End
Begin VB.CommandButton btnLayerAttribNew
Caption = "新建(&N)"
Height = 345
Left = 60
TabIndex = 1
Tag = "3171"
Top = 120
Width = 780
End
End
Begin MSComctlLib.ListView lsvFieldInfo
Height = 1755
Left = 105
TabIndex = 19
Top = 300
Width = 6630
_ExtentX = 11695
_ExtentY = 3096
View = 3
LabelEdit = 1
LabelWrap = -1 'True
HideSelection = -1 'True
FullRowSelect = -1 'True
GridLines = -1 'True
_Version = 393217
ForeColor = -2147483640
BackColor = -2147483643
BorderStyle = 1
Appearance = 1
NumItems = 8
BeginProperty ColumnHeader(1) {BDD1F052-858B-11D1-B16A-00C0F0283628}
Text = "名称"
Object.Width = 2540
EndProperty
BeginProperty ColumnHeader(2) {BDD1F052-858B-11D1-B16A-00C0F0283628}
SubItemIndex = 1
Object.Tag = "3164"
Text = "类型"
Object.Width = 1058
EndProperty
BeginProperty ColumnHeader(3) {BDD1F052-858B-11D1-B16A-00C0F0283628}
SubItemIndex = 2
Object.Tag = "3165"
Text = "长度"
Object.Width = 1058
EndProperty
BeginProperty ColumnHeader(4) {BDD1F052-858B-11D1-B16A-00C0F0283628}
SubItemIndex = 3
Object.Tag = "3166"
Text = "缺省值"
Object.Width = 1270
EndProperty
BeginProperty ColumnHeader(5) {BDD1F052-858B-11D1-B16A-00C0F0283628}
SubItemIndex = 4
Object.Tag = "3167"
Text = "自动编号"
Object.Width = 1587
EndProperty
BeginProperty ColumnHeader(6) {BDD1F052-858B-11D1-B16A-00C0F0283628}
SubItemIndex = 5
Object.Tag = "3168"
Text = "降序"
Object.Width = 1058
EndProperty
BeginProperty ColumnHeader(7) {BDD1F052-858B-11D1-B16A-00C0F0283628}
SubItemIndex = 6
Object.Tag = "3169"
Text = "必填"
Object.Width = 1058
EndProperty
BeginProperty ColumnHeader(8) {BDD1F052-858B-11D1-B16A-00C0F0283628}
SubItemIndex = 7
Object.Tag = "3170"
Text = "零长度允许"
Object.Width = 1940
EndProperty
End
Begin VB.Label Label5
Caption = "字段信息"
Height = 210
Left = 150
TabIndex = 20
Top = 90
Width = 1065
End
End
Attribute VB_Name = "frmModifyStructure"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Dim strFieldName As String
Private Sub btnLayerAttribCancel_Click() '退出
If txtFieldName.Enabled = True Then
If (txtFieldName.Text) <> "" Then
If MsgBox("当前新建的字段还没保存,保存吗?", vbYesNo + vbQuestion) = vbYes Then
btnLayerAttribSave_Click
End If
End If
End If
Unload Me
End Sub
Private Sub btnLayerAttribDel_Click() '删除字段
Dim objDs As soDataSource
Dim objDtVector As soDatasetVector
Dim objFieldInfo As soFieldInfo
Dim i As Integer
Dim bResult As Boolean
'得到数据源
Set objDs = frmMain.SuperWorkspace.Datasources.Item(1)
If objDs Is Nothing Then
MsgBox "错误!", vbInformation
Exit Sub
End If
'得到数据集
Set objDtVector = objDs.Datasets.Item(frmMain.cmbDataset.Text)
If objDtVector Is Nothing Then
MsgBox "错误!", vbInformation
Exit Sub
End If
'得到被选中的字段
bResult = False
For i = 1 To objDtVector.FieldCount
Set objFieldInfo = objDtVector.GetFieldInfo(i)
If objFieldInfo Is Nothing Then
MsgBox "错误!", vbInformation
Exit Sub
End If
If objFieldInfo.Name = lsvFieldInfo.SelectedItem.Text Then
bResult = True
Exit For
End If
Next
If bResult = False Then
MsgBox "属性数据表中没有该字段!", vbInformation
Else
objDtVector.ClearRecordsets 'DeleteField之前,关闭记录集
'删除字段
bResult = objDtVector.DeleteField(lsvFieldInfo.SelectedItem.Text)
End If
If bResult Then '成功
lsvFieldInfo.ListItems.Remove (i)
lsvFieldInfo.Refresh
Else '失败
MsgBox "删除字段失败!", vbInformation
End If
btnLayerAttribDel.Enabled = False
End Sub
Private Sub btnLayerAttribNew_Click() '新建字段
txtFieldName.Enabled = True
txtFieldName.BackColor = &H80000005
txtFieldName.Text = ""
cmbFieldType.Enabled = True
cmbFieldType.BackColor = &H80000005
txtFieldLen.Text = ""
cmbDefault.Enabled = True
cmbDefault.BackColor = &H80000005
chkAutomatic.Value = 0
chkDescending.Enabled = True
chkDescending.Value = 0
chkRequired.Enabled = True
chkRequired.Value = 0
chkAllowNull.Enabled = False
strFieldName = ""
btnLayerAttribNew.Enabled = False
btnLayerAttribSave.Enabled = True
btnLayerAttribCancel.Enabled = True
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -