Vbnet customization

try a application.doevents or something that will refresh the view. I have always had trouble with auto-clearing and checking of form elements such as checkboxes and drop down menus. I tend to write directly to the database row (if it exists) instead of manipulating the form element and refresh. There might be a easier way though.

Thanks,
Kunal




________________________________
From: rob.bucek <rob.bucek@...>
To: vantage@yahoogroups.com
Sent: Wednesday, March 18, 2009 1:16:23 PM
Subject: [Vantage] vbnet customization


i have a customization based on a field change (specifically a checkbox). If the user checks the box and answers yes to the msgbox that appears things will happen. If he answers no i would like the chkbox to clear and the script to end. Im having trouble with clearing the checkbox, the rest works great. any thoughts?

Private Sub JobClosing_BeforeFi eldChange( ByVal sender As object, ByVal args As DataColumnChangeEve ntArgs) Handles JobClosing_Column. ColumnChanging
'// ** Argument Properties and Uses **
'// args.Row("[FieldNam e]")
'// args.Column, args.ProposedValue, args.Row
'
'Add Event Handler Code
'
Select Case args.Column. ColumnName

Case "JobComplete"
Dim edvClose As EpiDataView = CType(oTrans. EpiDataViews( "Close"), EpiDataView)
Dim intSTK As Integer = edvClose.dataView( edvClose. Row)("StockQty" )
Dim strJobNum As String = edvClose.dataView( edvClose. Row)("JobNum" )
If intSTK > 0 Then
Dim response As MsgboxResult
Dim msg As String = "Has Inventory/WIP Reconciliation been run against this job?"
Dim title As String = "Costing."
response = MsgBox(msg, MsgBoxStyle. YesNo, title)
if response = MsgboxResult. yes then
UpdateJob()
Else
Dim chkCmplt As EpiCheckBox = ctype(csm.GetNative ControlReference ("811d9992- afdf-4597- b91c-78d663d436a a"),EpiCheckBox)
Dim vComplete As Boolean = edvClose.dataView( edvClose. Row)("JobComplet e")
vComplete = 0
chkCmplt.CheckedVal ue = False
End If
End If
Case Else

End Select

End Sub


Private Sub UpdateJob()
Dim edvClose As EpiDataView = CType(oTrans. EpiDataViews( "Close"), EpiDataView)
'Dim vProcID As Boolean = edvNC.dataView( edvNC.Row) ("ShortChar01" )
Dim vJobNum as String = edvClose.dataView( edvClose. Row)("JobNum" )
Dim adpJobEntry As JobEntryAdapter = New JobEntryAdapter( JobClosingForm)
adpJobEntry. BOConnect( )

Try
Dim JobNum As Boolean = adpJobEntry. GetByID(vJobNum)

adpJobEntry. JobEntryData. Tables("JobHead" ).Rows(0) .BeginEdit( )

adpJobEntry. JobEntryData. JobHead(0) ("CheckBox01" ) = True

adpJobEntry. JobEntryData. Tables("JobHead" ).Rows(0) .EndEdit( )
adpJobEntry. Update()

Catch e As Exception
'AddNewDraw( )
Finally
adpJobEntry. Dispose()
End Try

End Sub







[Non-text portions of this message have been removed]
i have a customization based on a field change (specifically a checkbox). If the user checks the box and answers yes to the msgbox that appears things will happen. If he answers no i would like the chkbox to clear and the script to end. Im having trouble with clearing the checkbox, the rest works great. any thoughts?

Private Sub JobClosing_BeforeFieldChange(ByVal sender As object, ByVal args As DataColumnChangeEventArgs) Handles JobClosing_Column.ColumnChanging
'// ** Argument Properties and Uses **
'// args.Row("[FieldName]")
'// args.Column, args.ProposedValue, args.Row
'
'Add Event Handler Code
'
Select Case args.Column.ColumnName

Case "JobComplete"
Dim edvClose As EpiDataView = CType(oTrans.EpiDataViews("Close"), EpiDataView)
Dim intSTK As Integer = edvClose.dataView(edvClose.Row)("StockQty")
Dim strJobNum As String = edvClose.dataView(edvClose.Row)("JobNum")
If intSTK > 0 Then
Dim response As MsgboxResult
Dim msg As String = "Has Inventory/WIP Reconciliation been run against this job?"
Dim title As String = "Costing."
response = MsgBox(msg, MsgBoxStyle.YesNo, title)
if response = MsgboxResult.yes then
UpdateJob()
Else
Dim chkCmplt As EpiCheckBox = ctype(csm.GetNativeControlReference("811d9992-afdf-4597-b91c-78d663d436aa"),EpiCheckBox)
Dim vComplete As Boolean = edvClose.dataView(edvClose.Row)("JobComplete")
vComplete = 0
chkCmplt.CheckedValue = False
End If
End If
Case Else

End Select

End Sub


Private Sub UpdateJob()
Dim edvClose As EpiDataView = CType(oTrans.EpiDataViews("Close"), EpiDataView)
'Dim vProcID As Boolean = edvNC.dataView(edvNC.Row)("ShortChar01")
Dim vJobNum as String = edvClose.dataView(edvClose.Row)("JobNum")
Dim adpJobEntry As JobEntryAdapter = New JobEntryAdapter(JobClosingForm)
adpJobEntry.BOConnect()

Try
Dim JobNum As Boolean = adpJobEntry.GetByID(vJobNum)

adpJobEntry.JobEntryData.Tables("JobHead").Rows(0).BeginEdit()

adpJobEntry.JobEntryData.JobHead(0)("CheckBox01" ) = True

adpJobEntry.JobEntryData.Tables("JobHead").Rows(0).EndEdit()
adpJobEntry.Update()

Catch e As Exception
'AddNewDraw()
Finally
adpJobEntry.Dispose()
End Try

End Sub
I would have updated the dataset, not the control.

In your code you really aren't updating the dataset.

Dim chkCmplt As EpiCheckBox =
ctype(csm.GetNativeControlReference("811d9992-afdf-4597-b91c-78d663d436aa"),
EpiCheckBox)

Here you are making a storage area for the dataset. It isn't a reference to
the dataset so any changes made to vComplete have no affect on the data

Dim vComplete As Boolean = edvClose.dataView(edvClose.Row)("JobComplete")

This line is probably the only thing you need to accomplish your goal of
clearing. The control will mimic what the data is telling it.

edvClose.dataView(edvClose.Row)("JobComplete")=0
vComplete = 0
chkCmplt.CheckedValue = False

From: vantage@yahoogroups.com [mailto:vantage@yahoogroups.com] On Behalf Of
rob.bucek
Sent: Wednesday, March 18, 2009 2:16 PM
To: vantage@yahoogroups.com
Subject: [Vantage] vbnet customization



i have a customization based on a field change (specifically a checkbox). If
the user checks the box and answers yes to the msgbox that appears things
will happen. If he answers no i would like the chkbox to clear and the
script to end. Im having trouble with clearing the checkbox, the rest works
great. any thoughts?

Private Sub JobClosing_BeforeFieldChange(ByVal sender As object, ByVal args
As DataColumnChangeEventArgs) Handles JobClosing_Column.ColumnChanging
'// ** Argument Properties and Uses **
'// args.Row("[FieldName]")
'// args.Column, args.ProposedValue, args.Row
'
'Add Event Handler Code
'
Select Case args.Column.ColumnName

Case "JobComplete"
Dim edvClose As EpiDataView = CType(oTrans.EpiDataViews("Close"),
EpiDataView)
Dim intSTK As Integer = edvClose.dataView(edvClose.Row)("StockQty")
Dim strJobNum As String = edvClose.dataView(edvClose.Row)("JobNum")
If intSTK > 0 Then
Dim response As MsgboxResult
Dim msg As String = "Has Inventory/WIP Reconciliation been run against this
job?"
Dim title As String = "Costing."
response = MsgBox(msg, MsgBoxStyle.YesNo, title)
if response = MsgboxResult.yes then
UpdateJob()
Else
Dim chkCmplt As EpiCheckBox =
ctype(csm.GetNativeControlReference("811d9992-afdf-4597-b91c-78d663d436aa"),
EpiCheckBox)
Dim vComplete As Boolean = edvClose.dataView(edvClose.Row)("JobComplete")
vComplete = 0
chkCmplt.CheckedValue = False
End If
End If
Case Else

End Select

End Sub


Private Sub UpdateJob()
Dim edvClose As EpiDataView = CType(oTrans.EpiDataViews("Close"),
EpiDataView)
'Dim vProcID As Boolean = edvNC.dataView(edvNC.Row)("ShortChar01")
Dim vJobNum as String = edvClose.dataView(edvClose.Row)("JobNum")
Dim adpJobEntry As JobEntryAdapter = New JobEntryAdapter(JobClosingForm)
adpJobEntry.BOConnect()

Try
Dim JobNum As Boolean = adpJobEntry.GetByID(vJobNum)

adpJobEntry.JobEntryData.Tables("JobHead").Rows(0).BeginEdit()

adpJobEntry.JobEntryData.JobHead(0)("CheckBox01" ) = True

adpJobEntry.JobEntryData.Tables("JobHead").Rows(0).EndEdit()
adpJobEntry.Update()

Catch e As Exception
'AddNewDraw()
Finally
adpJobEntry.Dispose()
End Try

End Sub





[Non-text portions of this message have been removed]
Obviously my nubie-ism was shining through! That did seem to work by the fact that it spiraled into an endless loop. But come to think of it, the way its structured..why wouldnt it right? now i have to pontificate on how to get around that LOL! You did get me thinking on that one so I do sincerely appreciated your help!
--- In vantage@yahoogroups.com, "Sean McDaniel" <smcdanie@...> wrote:
>
> I would have updated the dataset, not the control.
>
> In your code you really aren't updating the dataset.
>
> Dim chkCmplt As EpiCheckBox =
> ctype(csm.GetNativeControlReference("811d9992-afdf-4597-b91c-78d663d436aa"),
> EpiCheckBox)
>
> Here you are making a storage area for the dataset. It isn't a reference to
> the dataset so any changes made to vComplete have no affect on the data
>
> Dim vComplete As Boolean = edvClose.dataView(edvClose.Row)("JobComplete")
>
> This line is probably the only thing you need to accomplish your goal of
> clearing. The control will mimic what the data is telling it.
>
> edvClose.dataView(edvClose.Row)("JobComplete")=0
> vComplete = 0
> chkCmplt.CheckedValue = False
>
> From: vantage@yahoogroups.com [mailto:vantage@yahoogroups.com] On Behalf Of
> rob.bucek
> Sent: Wednesday, March 18, 2009 2:16 PM
> To: vantage@yahoogroups.com
> Subject: [Vantage] vbnet customization
>
>
>
> i have a customization based on a field change (specifically a checkbox). If
> the user checks the box and answers yes to the msgbox that appears things
> will happen. If he answers no i would like the chkbox to clear and the
> script to end. Im having trouble with clearing the checkbox, the rest works
> great. any thoughts?
>
> Private Sub JobClosing_BeforeFieldChange(ByVal sender As object, ByVal args
> As DataColumnChangeEventArgs) Handles JobClosing_Column.ColumnChanging
> '// ** Argument Properties and Uses **
> '// args.Row("[FieldName]")
> '// args.Column, args.ProposedValue, args.Row
> '
> 'Add Event Handler Code
> '
> Select Case args.Column.ColumnName
>
> Case "JobComplete"
> Dim edvClose As EpiDataView = CType(oTrans.EpiDataViews("Close"),
> EpiDataView)
> Dim intSTK As Integer = edvClose.dataView(edvClose.Row)("StockQty")
> Dim strJobNum As String = edvClose.dataView(edvClose.Row)("JobNum")
> If intSTK > 0 Then
> Dim response As MsgboxResult
> Dim msg As String = "Has Inventory/WIP Reconciliation been run against this
> job?"
> Dim title As String = "Costing."
> response = MsgBox(msg, MsgBoxStyle.YesNo, title)
> if response = MsgboxResult.yes then
> UpdateJob()
> Else
> Dim chkCmplt As EpiCheckBox =
> ctype(csm.GetNativeControlReference("811d9992-afdf-4597-b91c-78d663d436aa"),
> EpiCheckBox)
> Dim vComplete As Boolean = edvClose.dataView(edvClose.Row)("JobComplete")
> vComplete = 0
> chkCmplt.CheckedValue = False
> End If
> End If
> Case Else
>
> End Select
>
> End Sub
>
>
> Private Sub UpdateJob()
> Dim edvClose As EpiDataView = CType(oTrans.EpiDataViews("Close"),
> EpiDataView)
> 'Dim vProcID As Boolean = edvNC.dataView(edvNC.Row)("ShortChar01")
> Dim vJobNum as String = edvClose.dataView(edvClose.Row)("JobNum")
> Dim adpJobEntry As JobEntryAdapter = New JobEntryAdapter(JobClosingForm)
> adpJobEntry.BOConnect()
>
> Try
> Dim JobNum As Boolean = adpJobEntry.GetByID(vJobNum)
>
> adpJobEntry.JobEntryData.Tables("JobHead").Rows(0).BeginEdit()
>
> adpJobEntry.JobEntryData.JobHead(0)("CheckBox01" ) = True
>
> adpJobEntry.JobEntryData.Tables("JobHead").Rows(0).EndEdit()
> adpJobEntry.Update()
>
> Catch e As Exception
> 'AddNewDraw()
> Finally
> adpJobEntry.Dispose()
> End Try
>
> End Sub
>
>
>
>
>
> [Non-text portions of this message have been removed]
>