Code, Incoming! It's messy, yes. I've commented out some earlier
approaches if only to keep in front of me what didn't work. And
there's a structural problem in there that for the moment I'm ignoring.
Details button with the Employee Basic Adapter declaration set to the
form instead of the `sender' object is:
Error Detail
============
Object variable or With block variable not set.
Stack Trace
===========
at
Microsoft.VisualBasic.CompilerServices.Symbols.Container..ctor(Object
Instance)
at
Microsoft.VisualBasic.CompilerServices.NewLateBinding.LateGet(Object
Instance, Type Type, String MemberName, Object[] Arguments, String[]
ArgumentNames, Type[] TypeArguments, Boolean[] CopyBack)
at Script.DMRCorAct_AfterFieldChange(Object sender,
DataColumnChangeEventArgs args)
at System.Data.DataColumnChangeEventHandler.Invoke(Object sender,
DataColumnChangeEventArgs e)
at System.Data.DataTable.OnColumnChanged(DataColumnChangeEventArgs e)
at
Epicor.Mfg.BO.CorrectiveActionDataSet.DMRCorActDataTable.OnColumnChanged
(DataColumnChangeEventArgs e)
at System.Data.DataRow.set_Item(DataColumn column, Object value)
at System.Data.DataRowView.SetColumnValue(DataColumn column, Object
value)
at System.Data.DataRowView.set_Item(String property, Object value)
at
Epicor.Mfg.UI.FrameWork.EpiUltraCombo.EpiUltraCombo_Validating(Object
sender, CancelEventArgs e)
With it set to `Sender' I get:
Error Detail
============
Object reference not set to an instance of an object.
Stack Trace
===========
at Epicor.Mfg.UI.Adapters.EmpBasicAdapter.GetByID(String empID)
at Script.DMRCorAct_AfterFieldChange(Object sender,
DataColumnChangeEventArgs args)
at System.Data.DataColumnChangeEventHandler.Invoke(Object sender,
DataColumnChangeEventArgs e)
at System.Data.DataTable.OnColumnChanged(DataColumnChangeEventArgs e)
at
Epicor.Mfg.BO.CorrectiveActionDataSet.DMRCorActDataTable.OnColumnChanged(DataColumnChangeEventArgs
e)
at System.Data.DataRow.set_Item(DataColumn column, Object value)
at System.Data.DataRowView.SetColumnValue(DataColumn column, Object
value)
at System.Data.DataRowView.set_Item(String property, Object value)
at
Epicor.Mfg.UI.FrameWork.EpiUltraCombo.EpiUltraCombo_Validating(Object
sender, CancelEventArgs e)
'//**************************************************
'// Custom VB.NET code for CorrectiveActionForm
'// Created: 6/20/2008 2:21:37 PM
'//**************************************************
Imports System
Imports System.Data
Imports System.Diagnostics
Imports System.Windows.Forms
Imports System.ComponentModel
Imports Microsoft.VisualBasic
Imports Epicor.Mfg.UI
Imports Epicor.Mfg.UI.FrameWork
Imports Epicor.Mfg.UI.ExtendedProps
Imports Epicor.Mfg.UI.FormFunctions
Imports Epicor.Mfg.UI.Customization
Imports Epicor.Mfg.UI.Adapters
Imports Epicor.Mfg.UI.Searches
Imports Epicor.Mfg.BO
Module Script
'// ** Wizard Insert Location - Do Not Remove 'Begin/End
Wizard Added Module Level Variables' Comments! **
'// Begin Wizard Added Module Level Variables **
'// End Wizard Added Module Level Variables **
'// Add Custom Module Level Variables Here **
'Define the variables
Sub InitializeCustomCode()
'// ** Wizard Insert Location - Do not delete
'Begin/End Wizard Added Variable Intialization' lines **
'// Begin Wizard Added Variable Intialization
'// End Wizard Added Variable Intialization
'// Begin Custom Method Calls
'Private WithEvents tdtDueDate_e8c1ca29-5efa-4c36-aaef-962e2650a984 As
Epicor.Mfg.UI.FrameWork.EpiDateTimeEditor()
CreateRowRuleDMRCorActShortChar01Equals_Equals()
'// End Custom Method Calls
End Sub
Sub DestroyCustomCode()
'// ** Wizard Insert Location - Do not delete
'Begin/End Wizard Added Object Disposal' lines **
'// Begin Wizard Added Object Disposal
'// End Wizard Added Object Disposal
'// Begin Custom Code Disposal
'// End Custom Code Disposal
End Sub
Private Sub DMRCorAct_AfterFieldChange(ByVal sender As
object, ByVal args As DataColumnChangeEventArgs) Handles
DMRCorAct_Column.ColumnChanged
'// ** Argument Properties and Uses **
'// args.Row("[FieldName]")
'// args.Column,
args.ProposedValue, args.Row
'
'Add Event Handler Code
Dim edvDueDate As EpiDataView =
CType(oTrans.EpiDataViews("DMRCorAct"), EpiDataView)
Dim datNow As DateTime = DateTime.Now
Dim tdtDueDateCtrl As EpiDateTimeEditor =
CType(csm.GetNativeControlReference("e8c1ca29-5efa-4c36-aaef-962e2650a984"),
EpiDateTimeEditor)
Dim tdtDueDate As DateTime
'Make sure tdtDueDate is not null. Bad things happen
if it's null
If String.IsNullOrEmpty(tdtDueDateCtrl.ToString()) Then
tdtDueDate = DateTime.Now
Else
tdtDueDate = tdtDueDateCtrl.value
End If
Select Case args.Column.ColumnName
Case "ShortChar01"
'Automatically set Due Date based on selected
priority
Select CASE
ucbPriority.Text 'Would add hours for the top 3 but Vantage only sees
days despite SQL setup of 'DateTime' format. Humph!
CASE
"Emergency"
tdtDueDate = datNow.AddDays(0)
CASE "High"
tdtDueDate = datNow.AddDays(1)
CASE "Medium"
tdtDueDate = datNow.AddDays(3)
CASE "Low"
tdtDueDate = datNow.AddDays(7)
CASE
"Scheduled"
msgBox("Enter Scheduled Date", 65, "Manual Date Entry")
CASE Else
msgBox("Enter Work Order Priority", 65, "Priority Required")
End Select
'Set Due Date in the table
tdtDueDateCtrl.EpiFormat = "G"
'Set general date/time format so
that hours display, I wish
edvDueDate.dataView(edvDueDate.Row)("DuDate") = tdtDueDate
edvDueDate.Notify( New
EpiNotifyArgs("",edvDueDate.Row, edvDueDate.Column)) 'Tell the form
about it...
'Cleanup!
' edvDueDate = Nothing
datNow = Nothing
tdtDueDateCtrl = Nothing
tdtDueDate = Nothing
'Now add the email address...
' Case "ShortChar02"
'Can't use
ShortChar02 unless I copy the base method too - it overloads when I
want this in addition to vice instead of
' Dim edvCorAct As EpidataView =
Ctype(oTrans.EpiDataViews("DMRCorAct"), EpiDataView)
'Need this to get the right row of the table
' Dim strEmpID As String =
edvCorAct.dataview(edvCorAct.Row)("AsigndTo") 'Gets
us the ID we need to go into the EmpBasic table
Dim strEmpID As String =
edvDueDate.DataView(edvDueDate.Row)("AsigndTo")
msgBox(strEmpID, 65, "Employee ID") 'make sure I've
got an ID here....and I do
Dim varEmpBasic As EmpBasicAdapter = New
EmpBasicAdapter(CorrectiveActionForm)
'Connecting to the Employee Basic table with access to the email
field; edvDueDate is an instance of an object
Dim txtEpiEmpEmail as EpiTextBox =
CType(csm.GetNativeControlReference("5eb70999-6239-4928-8053-639382dfca3c"),
EpiTextBox) 'Will be helpful in displaying the email address
varEmpBasic.BOConnect()
'This shouldn't be an issue...
Dim Dummy as Boolean = varEmpBasic.GetByID(strEmpID)
'Now, something here is being
combative...
' Dim dvEmpBasic As DataView = New
DataView(varEmpBasic.EmpBasicData.Tables("EmpBasic"))
Dim dvEmpBasic =
Ctype(oTrans.EpiDataViews("EmpBasic"), EpiDataView) 'Set up Data
View to read Employee Email from table
Dim strEmail As String =
dvEmpBasic.DataView.Item(0)("EMailAddress")
'Get Employee's email address, I hope
'Will hold the email address but must
determine row before assigning a value
'
edvCorAct.dataView(edvCorAct.Row)("ShortChar02") = strEmail
'Put
email address into local table
edvDueDate.dataView(edvDueDate.Row)("ShortChar02") =
strEmail
' edvCorAct.Notify( New EpiNotifyArgs("",edvCorAct.Row,
edvCorAct.Column)) 'Refresh screen wtih email address
Case Else
End Select
edvDueDate.Notify( New
EpiNotifyArgs("",edvDueDate.Row, edvDueDate.Column))
End Sub
Private Sub CreateRowRuleDMRCorActShortChar01Equals_Equals
'// Description: Flag Emergency WO
'// **** begin autogenerated code ****
Dim exclamationDMRCorAct_Priority_Flag As
RuleAction = RuleAction.SetImage(oTrans, "DMRCorAct.Priority Flag",
"Exclamation")
Dim ruleActions As RuleAction() = new
RuleAction() {exclamationDMRCorAct_Priority_Flag}
Dim rrDMRCorActShortChar01Equals_Equals As
RowRule = New RowRule("ShortChar01", RuleCondition.Equals, "Emergency"
, ruleActions)
'// add to EpiDataView
CType(oTrans.EpiDataViews("DMRCorAct"),
EpiDataView).AddRowRule(rrDMRCorActShortChar01Equals_Equals)
'// **** end autogenerated code ****
End Sub
End Module
approaches if only to keep in front of me what didn't work. And
there's a structural problem in there that for the moment I'm ignoring.
Details button with the Employee Basic Adapter declaration set to the
form instead of the `sender' object is:
Error Detail
============
Object variable or With block variable not set.
Stack Trace
===========
at
Microsoft.VisualBasic.CompilerServices.Symbols.Container..ctor(Object
Instance)
at
Microsoft.VisualBasic.CompilerServices.NewLateBinding.LateGet(Object
Instance, Type Type, String MemberName, Object[] Arguments, String[]
ArgumentNames, Type[] TypeArguments, Boolean[] CopyBack)
at Script.DMRCorAct_AfterFieldChange(Object sender,
DataColumnChangeEventArgs args)
at System.Data.DataColumnChangeEventHandler.Invoke(Object sender,
DataColumnChangeEventArgs e)
at System.Data.DataTable.OnColumnChanged(DataColumnChangeEventArgs e)
at
Epicor.Mfg.BO.CorrectiveActionDataSet.DMRCorActDataTable.OnColumnChanged
(DataColumnChangeEventArgs e)
at System.Data.DataRow.set_Item(DataColumn column, Object value)
at System.Data.DataRowView.SetColumnValue(DataColumn column, Object
value)
at System.Data.DataRowView.set_Item(String property, Object value)
at
Epicor.Mfg.UI.FrameWork.EpiUltraCombo.EpiUltraCombo_Validating(Object
sender, CancelEventArgs e)
With it set to `Sender' I get:
Error Detail
============
Object reference not set to an instance of an object.
Stack Trace
===========
at Epicor.Mfg.UI.Adapters.EmpBasicAdapter.GetByID(String empID)
at Script.DMRCorAct_AfterFieldChange(Object sender,
DataColumnChangeEventArgs args)
at System.Data.DataColumnChangeEventHandler.Invoke(Object sender,
DataColumnChangeEventArgs e)
at System.Data.DataTable.OnColumnChanged(DataColumnChangeEventArgs e)
at
Epicor.Mfg.BO.CorrectiveActionDataSet.DMRCorActDataTable.OnColumnChanged(DataColumnChangeEventArgs
e)
at System.Data.DataRow.set_Item(DataColumn column, Object value)
at System.Data.DataRowView.SetColumnValue(DataColumn column, Object
value)
at System.Data.DataRowView.set_Item(String property, Object value)
at
Epicor.Mfg.UI.FrameWork.EpiUltraCombo.EpiUltraCombo_Validating(Object
sender, CancelEventArgs e)
'//**************************************************
'// Custom VB.NET code for CorrectiveActionForm
'// Created: 6/20/2008 2:21:37 PM
'//**************************************************
Imports System
Imports System.Data
Imports System.Diagnostics
Imports System.Windows.Forms
Imports System.ComponentModel
Imports Microsoft.VisualBasic
Imports Epicor.Mfg.UI
Imports Epicor.Mfg.UI.FrameWork
Imports Epicor.Mfg.UI.ExtendedProps
Imports Epicor.Mfg.UI.FormFunctions
Imports Epicor.Mfg.UI.Customization
Imports Epicor.Mfg.UI.Adapters
Imports Epicor.Mfg.UI.Searches
Imports Epicor.Mfg.BO
Module Script
'// ** Wizard Insert Location - Do Not Remove 'Begin/End
Wizard Added Module Level Variables' Comments! **
'// Begin Wizard Added Module Level Variables **
'// End Wizard Added Module Level Variables **
'// Add Custom Module Level Variables Here **
'Define the variables
Sub InitializeCustomCode()
'// ** Wizard Insert Location - Do not delete
'Begin/End Wizard Added Variable Intialization' lines **
'// Begin Wizard Added Variable Intialization
'// End Wizard Added Variable Intialization
'// Begin Custom Method Calls
'Private WithEvents tdtDueDate_e8c1ca29-5efa-4c36-aaef-962e2650a984 As
Epicor.Mfg.UI.FrameWork.EpiDateTimeEditor()
CreateRowRuleDMRCorActShortChar01Equals_Equals()
'// End Custom Method Calls
End Sub
Sub DestroyCustomCode()
'// ** Wizard Insert Location - Do not delete
'Begin/End Wizard Added Object Disposal' lines **
'// Begin Wizard Added Object Disposal
'// End Wizard Added Object Disposal
'// Begin Custom Code Disposal
'// End Custom Code Disposal
End Sub
Private Sub DMRCorAct_AfterFieldChange(ByVal sender As
object, ByVal args As DataColumnChangeEventArgs) Handles
DMRCorAct_Column.ColumnChanged
'// ** Argument Properties and Uses **
'// args.Row("[FieldName]")
'// args.Column,
args.ProposedValue, args.Row
'
'Add Event Handler Code
Dim edvDueDate As EpiDataView =
CType(oTrans.EpiDataViews("DMRCorAct"), EpiDataView)
Dim datNow As DateTime = DateTime.Now
Dim tdtDueDateCtrl As EpiDateTimeEditor =
CType(csm.GetNativeControlReference("e8c1ca29-5efa-4c36-aaef-962e2650a984"),
EpiDateTimeEditor)
Dim tdtDueDate As DateTime
'Make sure tdtDueDate is not null. Bad things happen
if it's null
If String.IsNullOrEmpty(tdtDueDateCtrl.ToString()) Then
tdtDueDate = DateTime.Now
Else
tdtDueDate = tdtDueDateCtrl.value
End If
Select Case args.Column.ColumnName
Case "ShortChar01"
'Automatically set Due Date based on selected
priority
Select CASE
ucbPriority.Text 'Would add hours for the top 3 but Vantage only sees
days despite SQL setup of 'DateTime' format. Humph!
CASE
"Emergency"
tdtDueDate = datNow.AddDays(0)
CASE "High"
tdtDueDate = datNow.AddDays(1)
CASE "Medium"
tdtDueDate = datNow.AddDays(3)
CASE "Low"
tdtDueDate = datNow.AddDays(7)
CASE
"Scheduled"
msgBox("Enter Scheduled Date", 65, "Manual Date Entry")
CASE Else
msgBox("Enter Work Order Priority", 65, "Priority Required")
End Select
'Set Due Date in the table
tdtDueDateCtrl.EpiFormat = "G"
'Set general date/time format so
that hours display, I wish
edvDueDate.dataView(edvDueDate.Row)("DuDate") = tdtDueDate
edvDueDate.Notify( New
EpiNotifyArgs("",edvDueDate.Row, edvDueDate.Column)) 'Tell the form
about it...
'Cleanup!
' edvDueDate = Nothing
datNow = Nothing
tdtDueDateCtrl = Nothing
tdtDueDate = Nothing
'Now add the email address...
' Case "ShortChar02"
'Can't use
ShortChar02 unless I copy the base method too - it overloads when I
want this in addition to vice instead of
' Dim edvCorAct As EpidataView =
Ctype(oTrans.EpiDataViews("DMRCorAct"), EpiDataView)
'Need this to get the right row of the table
' Dim strEmpID As String =
edvCorAct.dataview(edvCorAct.Row)("AsigndTo") 'Gets
us the ID we need to go into the EmpBasic table
Dim strEmpID As String =
edvDueDate.DataView(edvDueDate.Row)("AsigndTo")
msgBox(strEmpID, 65, "Employee ID") 'make sure I've
got an ID here....and I do
Dim varEmpBasic As EmpBasicAdapter = New
EmpBasicAdapter(CorrectiveActionForm)
'Connecting to the Employee Basic table with access to the email
field; edvDueDate is an instance of an object
Dim txtEpiEmpEmail as EpiTextBox =
CType(csm.GetNativeControlReference("5eb70999-6239-4928-8053-639382dfca3c"),
EpiTextBox) 'Will be helpful in displaying the email address
varEmpBasic.BOConnect()
'This shouldn't be an issue...
Dim Dummy as Boolean = varEmpBasic.GetByID(strEmpID)
'Now, something here is being
combative...
' Dim dvEmpBasic As DataView = New
DataView(varEmpBasic.EmpBasicData.Tables("EmpBasic"))
Dim dvEmpBasic =
Ctype(oTrans.EpiDataViews("EmpBasic"), EpiDataView) 'Set up Data
View to read Employee Email from table
Dim strEmail As String =
dvEmpBasic.DataView.Item(0)("EMailAddress")
'Get Employee's email address, I hope
'Will hold the email address but must
determine row before assigning a value
'
edvCorAct.dataView(edvCorAct.Row)("ShortChar02") = strEmail
'Put
email address into local table
edvDueDate.dataView(edvDueDate.Row)("ShortChar02") =
strEmail
' edvCorAct.Notify( New EpiNotifyArgs("",edvCorAct.Row,
edvCorAct.Column)) 'Refresh screen wtih email address
Case Else
End Select
edvDueDate.Notify( New
EpiNotifyArgs("",edvDueDate.Row, edvDueDate.Column))
End Sub
Private Sub CreateRowRuleDMRCorActShortChar01Equals_Equals
'// Description: Flag Emergency WO
'// **** begin autogenerated code ****
Dim exclamationDMRCorAct_Priority_Flag As
RuleAction = RuleAction.SetImage(oTrans, "DMRCorAct.Priority Flag",
"Exclamation")
Dim ruleActions As RuleAction() = new
RuleAction() {exclamationDMRCorAct_Priority_Flag}
Dim rrDMRCorActShortChar01Equals_Equals As
RowRule = New RowRule("ShortChar01", RuleCondition.Equals, "Emergency"
, ruleActions)
'// add to EpiDataView
CType(oTrans.EpiDataViews("DMRCorAct"),
EpiDataView).AddRowRule(rrDMRCorActShortChar01Equals_Equals)
'// **** end autogenerated code ****
End Sub
End Module