cancel
Showing results for 
Search instead for 
Did you mean: 

Form/Event Error

Former Member
0 Kudos

I have the folllowing code in the item event:

If pVal.FormTypeEx = "mcgscomm" Then

If pVal.EventType = SAPbouiCOM.BoEventTypes.et_ITEM_PRESSED And pVal.BeforeAction = False Then

If pVal.ItemUID = "btnOk" Then

CleanForm(oForm)

End If

End If

End If

The Cleanform routines is as follows:

Private Sub CleanForm(ByRef oForm As SAPbouiCOM.Form)

Dim oMatrix As SAPbouiCOM.Matrix

Dim oStaticText As SAPbouiCOM.StaticText

Dim oEditText As SAPbouiCOM.EditText

oMatrix = oForm.Items.Item("M_Matrix").Specific

oMatrix.Clear()

oStaticText = oForm.Items.Item("mcg_CName").Specific

oStaticText.Caption = ""

oEditText = oForm.Items.Item("mcg_Date").Specific

oEditText.Value = ""

oEditText = oForm.Items.Item("mcg_Inv").Specific

oEditText.Value = ""

oForm.DataSources.UserDataSources.Item("StatusDS").ValueEx = "Selected"

oForm.DataSources.UserDataSources.Item("SlspDS").ValueEx = ""

oForm.DataSources.UserDataSources.Item("CustDS").ValueEx = ""

oForm.DataSources.UserDataSources.Item("SalesDS").ValueEx = 0

oForm.DataSources.UserDataSources.Item("CostDS").ValueEx = 0

oForm.DataSources.UserDataSources.Item("CommDS").ValueEx = 0

oForm.DataSources.UserDataSources.Item("CPerDS").ValueEx = 0

oEditText.Active = True

End Sub

The issue is that the cleanform executes without problem but when the item event completes the application crashes (I'm not getting any messages from the debugger so it's making hard to determine the issue). Any suggestions?

Regards,

WB

Accepted Solutions (1)

Accepted Solutions (1)

Nussi
Active Contributor
0 Kudos

hi william,

the only thing i see is that you don't freeze the form.

you're creating events when you "clear" your form and slow down

your code

Former Member
0 Kudos

I have taken out the freeze statement for debugging purposes. The code is not slowing down, it's crashing.

Gianluigi
Product and Topic Expert
Product and Topic Expert
0 Kudos

Is your code VB6 or VB.NET ?

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi,

did you tried try catch syntax for errors? If yes, there was no error?

Petr

Former Member
0 Kudos

The reason I posted the code is if somebody wanted to test it. There is an error the program is crashing, it crashing during debug mode. What I don't understand is why it crashing when the event is done, it's not crashing in the middle of the routines it's after calling the clean routine from the event routine.

The code is .net 2005

Regards,

WB

Gianluigi
Product and Topic Expert
Product and Topic Expert
0 Kudos

VB.NET: good. Then you can use B1 .NET Profiler to understand what you addon is really doing. This tool will profile the execution of your addon by tracing all the DI and UI calls (and event handling) and will trace also exception raised. You don't need neither debug nor source code as it profiles directly the execution doing some magic in the CLR.

It is part of B1TE. You can download it under the section "Business One SDK Tools". It comes with setup / documentation and source code too.

Enjoy.

Former Member
0 Kudos

Thanks for the suggestion, I figure it out. The .net profiler gave me an idea where it was crashing, now the weird thing and in this case I think is VS.NET that has a bug with the DI/UI API. When I changed the editbox, this was triggering a et_VALIDATE event that I'm trapping in the item event. Now the debugger was running the event code but it was not showing it, if I placed a breakpoint it will never stop so that was not letting me know that the error was occurring there.

As soon as I figure it out a small if statement fixed the problem.

Thanks to all,

WB