cancel
Showing results for 
Search instead for 
Did you mean: 

Event Handling

Former Member
0 Kudos

After creating a project using VB B1 Add on Wizard ,there is a class generated for handling the events for a button

Option Strict Off

Option Explicit On

Imports B1WizardBase

Imports SAPbobsCOM

Imports SAPbouiCOM

Namespace B1AddOn1

Public Class Button__1__3

Inherits B1Item

Public Sub New()

MyBase.New()

FormType = "-1"

ItemUID = "3"

End Sub

<B1Listener(BoEventTypes.et_CLICK, True)> _

Public Overridable Function OnBeforeClick(ByVal pVal As ItemEvent) As Boolean

Dim form As Form = B1Connections.theAppl.Forms.Item(pVal.FormUID)

Dim item As Item = form.Items.Item("3")

Dim button As Button = CType(item.Specific, Button)

'ADD YOUR ACTION CODE HERE ...

Return True

End Function

End Class

End Namespace

but this code is not working when i clicked the button.

Please help

Accepted Solutions (0)

Answers (2)

Answers (2)

former_member191896
Active Participant
0 Kudos

Hi Satyapal,

Please add your own code where it says 'ADD YOUR ACTION CODE HERE ...

For example something like: MessageBox.Show("this is a test")

The generated code does not perform any action. It generates the class structures, methods etc. so you can focus on implementing the business/functional logic.

Regards

Aravind

Nussi
Active Contributor
0 Kudos

Hi,

the questions is: what is the error ?

use try catch

in your code and post the error message here.

lg David

Former Member
0 Kudos

Hi David ,

thank you for the help.

But my question is, after creating the project using VB B1AddOn Wizard ,so many class files are generated for each component (Button1,Button2,EditText1,EditText2,ComboBox...)

and corresponding listeners are in the file, but this events are not working. There is no errors.

Please Help

Nussi
Active Contributor
0 Kudos

Hi,

maybe you should first have a look at the SDK samples to get a better overview about

how to develop Business One AddOns and how the structure of the code looks like.

a bit offtopic:

honestly i don't like wizard generated templates.

i invested once some time to make my own template; in my opinion that's way more professional.

lg David