Newbie Question: How to use EpiUIException()?

I ran into the same thing. Try Throw New UIException() and see if that works.




________________________________
From: bjcracosta <racosta@...>
To: vantage@yahoogroups.com
Sent: Thursday, December 4, 2008 2:53:19 PM
Subject: [Vantage] Newbie Question: How to use EpiUIException()?


Hello Guru's,

I'm trying to trap data entry error. But, the field with the error
loses focus. Page 122 of the Epicor Tools User Guide says to add the
following code.

Throw New EpiUIException( )
When the Validation condition is
not met

Testing the code results in:

Compiling Custom Code ...

----------errors- --------- --

Error: BC30002 - line 112 (174) - Type 'EpiUIException' is not
defined.

** Compile Failed. **

I don't know what I need to add to the code to get it to work, being
a VB.NET and Vantage newbie. We're on 8.03.406A. My script is below.

Thanks,
Reggie Acosta
Brown Jordan Company

'//********* ********* ********* ********* ********* *****
'// Custom VB.NET code for UD02Form
'// Created: 12/1/2008 3:37:05 PM
'//********* ********* ********* ********* ********* *****
Imports System
Imports System.Data
Imports System.Diagnostics
Imports System.Windows. Forms
Imports System.ComponentMod el
Imports System.Text. RegularExpressio ns
Imports Microsoft.VisualBas ic
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 **

Private WithEvents edvUD02 As EpiDataView
'// Add Custom Module Level Variables Here **

Sub InitializeCustomCod e()

'// ** Wizard Insert Location - Do not
delete 'Begin/End Wizard Added Variable Intialization' lines **
'// Begin Wizard Added Variable Intialization

edvUD02 = CType(oTrans. EpiDataViews( "UD02"), EpiDataView)

'// End Wizard Added Variable Intialization
'// Begin Custom Method Calls

SetExtendedProps( )
'// 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

edvUD02 = Nothing

'// End Wizard Added Object Disposal
'// Begin Custom Code Disposal

'// End Custom Code Disposal
End Sub

Private Sub SetExtendedProps( )
'// Customization to set extended properties
Dim edv As EpiDataView = CType(oTrans. EpiDataViews( "UD02"),
EpiDataView)

If edv.dataView. Table.Columns. Contains( "Key2") Then
edv.dataView. Table.Columns( "Key2").Extended Properties
("ReadOnly") = True
edv.dataView. Table.Columns( "Key2").Extended Properties
("Enabled") = False
edv.dataView. Table.Columns( "Key2").Extended Properties
("IsHidden") = True
End if
If edv.dataView. Table.Columns. Contains( "Key3") Then
edv.dataView. Table.Columns( "Key3").Extended Properties
("ReadOnly") = True
edv.dataView. Table.Columns( "Key3").Extended Properties
("Enabled") = False
edv.dataView. Table.Columns( "Key3").Extended Properties
("IsHidden") = True
End if
If edv.dataView. Table.Columns. Contains( "Key4") Then
edv.dataView. Table.Columns( "Key4").Extended Properties
("ReadOnly") = True
edv.dataView. Table.Columns( "Key4").Extended Properties
("Enabled") = False
edv.dataView. Table.Columns( "Key4").Extended Properties
("IsHidden") = True
End if
If edv.dataView. Table.Columns. Contains( "Key5") Then
edv.dataView. Table.Columns( "Key5").Extended Properties
("ReadOnly") = True
edv.dataView. Table.Columns( "Key5").Extended Properties
("Enabled") = False
edv.dataView. Table.Columns( "Key5").Extended Properties
("IsHidden") = True
End if
If edv.dataView. Table..Columns. Contains( "Number01" ) Then
edv.dataView. Table.Columns( "Number01" ).ExtendedProper ties
("Format") = "->>,>>>,>>9. 99999"
End if
If edv.dataView. Table.Columns. Contains( "Number02" ) Then
edv.dataView. Table.Columns( "Number02" ).ExtendedProper ties
("Format") = "->9.999"
End if
End Sub

Private Sub UD02_BeforeFieldCha nge(ByVal sender As object,
ByVal args As DataColumnChangeEve ntArgs) Handles
UD02_Column. ColumnChanging
'// ** Argument Properties and Uses **
'// args.Row("[FieldNam e]")
'// args.Column, args.ProposedValue, args.Row
'
'Add Event Handler Code
'
Dim r as New Regex("^([1- 9]|[1-9][ 0-9])$")
Select Case args.Column. ColumnName

Case "Key1"
If not r.IsMatch(args. ProposedValue)
Then
messageBox.Show( "Please enter
numeric code only.")
Throw New EpiUIException)
End If
Case Else

End Select
r = Nothing
End Sub


End Module






[Non-text portions of this message have been removed]
Hello Guru's,

I'm trying to trap data entry error. But, the field with the error
loses focus. Page 122 of the Epicor Tools User Guide says to add the
following code.

Throw New EpiUIException()
When the Validation condition is
not met

Testing the code results in:

Compiling Custom Code ...


----------errors------------

Error: BC30002 - line 112 (174) - Type 'EpiUIException' is not
defined.


** Compile Failed. **

I don't know what I need to add to the code to get it to work, being
a VB.NET and Vantage newbie. We're on 8.03.406A. My script is below.

Thanks,
Reggie Acosta
Brown Jordan Company


'//**************************************************
'// Custom VB.NET code for UD02Form
'// Created: 12/1/2008 3:37:05 PM
'//**************************************************
Imports System
Imports System.Data
Imports System.Diagnostics
Imports System.Windows.Forms
Imports System.ComponentModel
Imports System.Text.RegularExpressions
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 **

Private WithEvents edvUD02 As EpiDataView
'// Add Custom Module Level Variables Here **



Sub InitializeCustomCode()


'// ** Wizard Insert Location - Do not
delete 'Begin/End Wizard Added Variable Intialization' lines **
'// Begin Wizard Added Variable Intialization

edvUD02 = CType(oTrans.EpiDataViews("UD02"), EpiDataView)

'// End Wizard Added Variable Intialization
'// Begin Custom Method Calls

SetExtendedProps()
'// 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

edvUD02 = Nothing

'// End Wizard Added Object Disposal
'// Begin Custom Code Disposal

'// End Custom Code Disposal
End Sub

Private Sub SetExtendedProps()
'// Customization to set extended properties
Dim edv As EpiDataView = CType(oTrans.EpiDataViews("UD02"),
EpiDataView)

If edv.dataView.Table.Columns.Contains("Key2") Then
edv.dataView.Table.Columns("Key2").ExtendedProperties
("ReadOnly") = True
edv.dataView.Table.Columns("Key2").ExtendedProperties
("Enabled") = False
edv.dataView.Table.Columns("Key2").ExtendedProperties
("IsHidden") = True
End if
If edv.dataView.Table.Columns.Contains("Key3") Then
edv.dataView.Table.Columns("Key3").ExtendedProperties
("ReadOnly") = True
edv.dataView.Table.Columns("Key3").ExtendedProperties
("Enabled") = False
edv.dataView.Table.Columns("Key3").ExtendedProperties
("IsHidden") = True
End if
If edv.dataView.Table.Columns.Contains("Key4") Then
edv.dataView.Table.Columns("Key4").ExtendedProperties
("ReadOnly") = True
edv.dataView.Table.Columns("Key4").ExtendedProperties
("Enabled") = False
edv.dataView.Table.Columns("Key4").ExtendedProperties
("IsHidden") = True
End if
If edv.dataView.Table.Columns.Contains("Key5") Then
edv.dataView.Table.Columns("Key5").ExtendedProperties
("ReadOnly") = True
edv.dataView.Table.Columns("Key5").ExtendedProperties
("Enabled") = False
edv.dataView.Table.Columns("Key5").ExtendedProperties
("IsHidden") = True
End if
If edv.dataView.Table.Columns.Contains("Number01") Then
edv.dataView.Table.Columns("Number01").ExtendedProperties
("Format") = "->>,>>>,>>9.99999"
End if
If edv.dataView.Table.Columns.Contains("Number02") Then
edv.dataView.Table.Columns("Number02").ExtendedProperties
("Format") = "->9.999"
End if
End Sub


Private Sub UD02_BeforeFieldChange(ByVal sender As object,
ByVal args As DataColumnChangeEventArgs) Handles
UD02_Column.ColumnChanging
'// ** Argument Properties and Uses **
'// args.Row("[FieldName]")
'// args.Column, args.ProposedValue, args.Row
'
'Add Event Handler Code
'
Dim r as New Regex("^([1-9]|[1-9][0-9])$")
Select Case args.Column.ColumnName

Case "Key1"
If not r.IsMatch(args.ProposedValue)
Then
messageBox.Show("Please enter
numeric code only.")
Throw New EpiUIException)
End If
Case Else

End Select
r = Nothing
End Sub



End Module