📄 frminfo.frm
字号:
End
Begin VB.Label lblTitle
AutoSize = -1 'True
Caption = "邮编"
Height = 180
Index = 21
Left = 5640
TabIndex = 50
Top = 4020
Width = 360
End
Begin VB.Label lblTitle
AutoSize = -1 'True
Caption = "地址"
Height = 180
Index = 20
Left = 600
TabIndex = 49
Top = 4020
Width = 360
End
Begin VB.Label lblTitle
AutoSize = -1 'True
Caption = "城市"
Height = 180
Index = 19
Left = 4200
TabIndex = 48
Top = 3660
Width = 360
End
Begin VB.Label lblTitle
AutoSize = -1 'True
Caption = "省份"
Height = 180
Index = 18
Left = 2160
TabIndex = 47
Top = 3645
Width = 360
End
Begin VB.Label lblTitle
AutoSize = -1 'True
Caption = "国家"
Height = 180
Index = 17
Left = 600
TabIndex = 46
Top = 3660
Width = 360
End
Begin VB.Label lblTitle
AutoSize = -1 'True
Caption = "地区"
Height = 180
Index = 16
Left = 4200
TabIndex = 45
Top = 3300
Width = 360
End
Begin VB.Label lblTitle
AutoSize = -1 'True
Caption = "重要程度"
Height = 180
Index = 15
Left = 240
TabIndex = 44
Top = 3300
Width = 720
End
Begin VB.Label lblTitle
AutoSize = -1 'True
Caption = "税号"
Height = 180
Index = 14
Left = 4200
TabIndex = 43
Top = 2940
Width = 360
End
Begin VB.Label lblTitle
AutoSize = -1 'True
Caption = "帐号"
Height = 180
Index = 13
Left = 600
TabIndex = 42
Top = 2940
Width = 360
End
Begin VB.Label lblTitle
AutoSize = -1 'True
Caption = "开户银行"
Height = 180
Index = 12
Left = 3840
TabIndex = 41
Top = 2580
Width = 720
End
Begin VB.Label lblTitle
AutoSize = -1 'True
Caption = "信誉等级"
Height = 180
Index = 11
Left = 240
TabIndex = 40
Top = 2580
Width = 720
End
Begin VB.Label lblTitle
AutoSize = -1 'True
Caption = "行业"
Height = 180
Index = 10
Left = 4200
TabIndex = 39
Top = 2220
Width = 360
End
Begin VB.Label lblTitle
AutoSize = -1 'True
Caption = "网址"
Height = 180
Index = 9
Left = 600
TabIndex = 38
Top = 2220
Width = 360
End
Begin VB.Label lblTitle
AutoSize = -1 'True
Caption = "邮件"
Height = 180
Index = 8
Left = 4200
TabIndex = 37
Top = 1860
Width = 360
End
Begin VB.Label lblTitle
AutoSize = -1 'True
Caption = "传真"
Height = 180
Index = 7
Left = 600
TabIndex = 36
Top = 1860
Width = 360
End
Begin VB.Label lblTitle
AutoSize = -1 'True
Caption = "电话"
Height = 180
Index = 6
Left = 4200
TabIndex = 35
Top = 1500
Width = 360
End
Begin VB.Label lblTitle
AutoSize = -1 'True
Caption = "来源"
Height = 180
Index = 5
Left = 600
TabIndex = 34
Top = 1500
Width = 360
End
Begin VB.Label lblTitle
AutoSize = -1 'True
Caption = "类型"
Height = 180
Index = 4
Left = 4200
TabIndex = 33
Top = 1140
Width = 360
End
Begin VB.Label lblTitle
AutoSize = -1 'True
Caption = "性质"
Height = 180
Index = 3
Left = 600
TabIndex = 32
Top = 1140
Width = 360
End
Begin VB.Label lblTitle
AutoSize = -1 'True
Caption = "法人代表"
Height = 180
Index = 2
Left = 3840
TabIndex = 31
Top = 780
Width = 720
End
Begin VB.Label lblTitle
AutoSize = -1 'True
Caption = "编号"
Height = 180
Index = 0
Left = 600
TabIndex = 29
Top = 765
Width = 360
End
Begin VB.Label lblTitle
AutoSize = -1 'True
Caption = "客户名称"
Height = 180
Index = 1
Left = 240
TabIndex = 28
Top = 420
Width = 720
End
End
Attribute VB_Name = "frmClientInfo"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
''''''''''''''''''''''''''''''''''''''''''''''''
'本模块为1.显示客户的详细信息,2.编辑客户信息,3.新建客户记录
'调用本模块前请先设置好Style属性,该属性为本模块的显示样式
'
''''''''''''''''''''''''''''''''''''''''''''''''
Option Explicit
'=================定义==========================
Dim mStyleInt As Integer
Dim mEnbledBool As Boolean
Dim mClientCls As clsClient
'===============================================
'=================属性==========================
'Style 属性决定本窗口的显示样式
Public Property Let Style(nStyle As Integer)
mStyleInt = nStyle
Call InitForm
End Property
Public Property Get Style() As Integer
Style = mStyleInt
End Property
'当前操作的用户对象
Public Property Let TClient(TMyClient As clsClient)
Set mClientCls = TMyClient
Call ShowInfo
End Property
Public Property Get TClient() As clsClient
Set TClient = mClientCls
End Property
'================================================
'"关闭"按纽
Private Sub cmdClose_Click()
gClientFrm.DataChanged = False
Unload Me
End Sub
'"修改"按纽
Private Sub cmdEdit_Click()
Me.Style = INT_CLIENT_STYLE_EDIT
End Sub
'"确定"按纽
Private Sub cmdOK_Click()
Dim MyObject As Control, i As Integer, strTag As String, nTag As Integer
If Not (mClientCls Is Nothing) Then
For Each MyObject In Me.Controls '枚举所有控件
DoEvents
strTag = MyObject.Tag ' tag属性为该控件对应相应的数据库字段编号
If IsNumeric(strTag) Then
nTag = CInt(strTag)
If nTag >= 0 And nTag < INT_CLIENT_TITLE_COUNT_NUMBER Then '更新 客户信息(属性)
Select Case UCase(TypeName(MyObject)) '根据控件的不同类型,来读取相应的属性值
Case "TEXTBOX"
mClientCls.MyProperty(nTag) = MyObject.Text
Case "DTPICKER"
mClientCls.MyProperty(nTag) = MyObject.Value
Case "COMBOBOX"
mClientCls.MyProperty(nTag) = MyObject.Text
End Select
End If
End If
Next
'设置frmclient窗口的DataChanged属性,告诉他 客户数据已经改变
TClient.IsChangedDate = True
End If
Unload Me
End Sub
'********************************************************************
'功能:把客户的各个信息分别显示在 各个控件上
'参数:无
'返回值:Boolean 型值,如果显示成功返回True
'********************************************************************
Public Function ShowInfo() As Boolean
Dim MyObject As Control, strTag As String, nTag As Integer, strTemp As String
If Not (TClient Is Nothing) Then
For Each MyObject In Me.Controls
DoEvents
strTag = MyObject.Tag ' tag属性为该控件对应相应的数据库字段编号
If IsNumeric(strTag) Then
nTag = CInt(strTag)
If nTag >= 0 And nTag < INT_CLIENT_TITLE_COUNT_NUMBER Then
strTemp = mClientCls.MyProperty(nTag)
If strTemp <> "" Then
Select Case UCase(TypeName(MyObject)) '根据控件的不同类型,来读取相应的属性值
Case "TEXTBOX"
MyObject.Text = strTemp
Case "DTPICKER"
MyObject.Value = strTemp
Case "COMBOBOX"
MyObject.Text = strTemp
End Select
End If
End If
End If
Next
ShowInfo = True
Else
ShowInfo = False
End If
End Function
'********************************************************************
'功能:初始化窗口(设置窗口的显示模式)
'参数:无
'返回值:无
'********************************************************************
Private Function InitForm()
Select Case Me.Style
Case INT_CLIENT_STYLE_READ_ONLY '只读,不能修改
If mEnbledBool = True Then Call SetControlEnabled(False)
cmdOk.Visible = False
cmdEdit.Visible = True
Case INT_CLIENT_STYLE_EDIT '修改
cmdOk.Visible = True
cmdEdit.Visible = False
If mEnbledBool = False Then Call SetControlEnabled(True)
Case INT_CLIENT_STYLE_NEW '新建 客户
cmdOk.Visible = True
cmdEdit.Visible = False
If mEnbledBool = False Then Call SetControlEnabled(True) '本来就是 True的可以不设置
End Select
End Function
'********************************************************************
'功能:设置所有显示信息的控件的 状态
'参数:boolEnabled 为状态值,boolEnabled为False的话使控件失效,反之生效
'返回值:无
'********************************************************************
Private Function SetControlEnabled(boolEnabled As Boolean)
Dim nLastTextIndex As Integer, nLastComboIndex As Integer, i As Integer
mEnbledBool = boolEnabled
nLastTextIndex = txtField.UBound
nLastComboIndex = cmbField.UBound
For i = 0 To nLastTextIndex '遍历TEXTBOX控件
DoEvents
If Not (txtField(i) Is Nothing) Then
txtField(i).Enabled = boolEnabled
End If
Next i
For i = 0 To nLastComboIndex '遍历ComboBox控件
DoEvents
If Not (cmbField(i) Is Nothing) Then
cmbField(i).Enabled = boolEnabled
End If
Next i
DTPField.Enabled = boolEnabled
End Function
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -