Private WithEvents OperationCtrlEdit As VBControlExtenderPrivate Sub DoOperationCtrl()
Dim i As Integer
Dim x As ListItem
Set x = LvwOperation.SelectedItem
Set OperationCtrlEdit = UserControl.Controls.Add("AD_OperationCtl.Operation", "OperationCtrlEdit", Me)
SetParentEx OperationCtrlEdit.object.hwnd, UserControl.hwnd
With OperationCtrlEdit
If x Is Nothing Then
.Top = UserControl.Extender.Top + LvwOperation.Top
Else
.Top = UserControl.Extender.Top + LvwOperation.Top + x.Top + x.Height
End If
.Left = UserControl.Extender.Left + (LvwOperation.Width - .Width) / 2
.ZOrder 0
.object.InitializeControl
.Visible = True
.object.DoActionEx tmpOperation
End With
picContainer.Enabled = False
End SubPrivate Sub OperationCtrlEdit_ObjectEvent(Info As EventInfo)
Dim IsNew As Boolean, lSaveReturn As Long
Select Case Info.Name
Case "ActionComplete":
If Info.EventParameters("Canceled").Value = False Then
Set tmpOperation = Info.EventParameters("DesObj").Value
If Not (tmpOperation Is Nothing) Then
If tmpOperation.ID > 0 Then
IsNew = False
Else
IsNew = True
End If
If IsNew Then
lSaveReturn = tmpOperation.SaveData
Else
lSaveReturn = tmpOperation.SaveToUpdate
End If
If lSaveReturn <> 0 Then
MsgBox "数据保存不成功.", vbOKOnly, "提示信息"
Else
If IsNew Then
' AddLog G_LoginID, "增加记录", "业务记录管理", "增加了编号为:" & tmpOperation.ID & " 记录."
Else
' AddLog G_LoginID, "修改记录", "业务记录管理", "修改了编号为:" & tmpOperation.ID & " 记录."
End If
InitializeControl '不用这个方法
End If
End If
End If
Set tmpOperation = Nothing
UserControl.Controls.Remove "OperationCtrlEdit"
Set OperationCtrlEdit = Nothing
End Select
picContainer.Enabled = True
End Sub
Dim i As Integer
Dim x As ListItem
Set x = LvwOperation.SelectedItem
Set OperationCtrlEdit = UserControl.Controls.Add("AD_OperationCtl.Operation", "OperationCtrlEdit", Me)
SetParentEx OperationCtrlEdit.object.hwnd, UserControl.hwnd
With OperationCtrlEdit
If x Is Nothing Then
.Top = UserControl.Extender.Top + LvwOperation.Top
Else
.Top = UserControl.Extender.Top + LvwOperation.Top + x.Top + x.Height
End If
.Left = UserControl.Extender.Left + (LvwOperation.Width - .Width) / 2
.ZOrder 0
.object.InitializeControl
.Visible = True
.object.DoActionEx tmpOperation
End With
picContainer.Enabled = False
End SubPrivate Sub OperationCtrlEdit_ObjectEvent(Info As EventInfo)
Dim IsNew As Boolean, lSaveReturn As Long
Select Case Info.Name
Case "ActionComplete":
If Info.EventParameters("Canceled").Value = False Then
Set tmpOperation = Info.EventParameters("DesObj").Value
If Not (tmpOperation Is Nothing) Then
If tmpOperation.ID > 0 Then
IsNew = False
Else
IsNew = True
End If
If IsNew Then
lSaveReturn = tmpOperation.SaveData
Else
lSaveReturn = tmpOperation.SaveToUpdate
End If
If lSaveReturn <> 0 Then
MsgBox "数据保存不成功.", vbOKOnly, "提示信息"
Else
If IsNew Then
' AddLog G_LoginID, "增加记录", "业务记录管理", "增加了编号为:" & tmpOperation.ID & " 记录."
Else
' AddLog G_LoginID, "修改记录", "业务记录管理", "修改了编号为:" & tmpOperation.ID & " 记录."
End If
InitializeControl '不用这个方法
End If
End If
End If
Set tmpOperation = Nothing
UserControl.Controls.Remove "OperationCtrlEdit"
Set OperationCtrlEdit = Nothing
End Select
picContainer.Enabled = True
End Sub
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货