Hi,
until now i developed my addons with vb6.
Now i have the opportunity to start using .net.
First of all, which version do you suggest? VS 2003 or VS 2005?
Which advtantages/differences should i consider?
Are there any special features?
Notice that i already use .net for other windows forms application.
Thanks
Paolo
Paolo hi -
"Seems that i can add listners only if the class name of the form begins with 'Form__'. Is that correct?"
The wizard takes care of generating classes and listeners
for you. You select the objects you want to work with and
then you add your functional code in the placeholders
generated automatically for you. You don't need to care
about the name of forms.
"How do i use DI in this scenario?"
The wizard generates for you an add-on that uses DI and
UI. By using the singleton object B1Connections you can
access the UI connection or the DI company and then you
can do whatever you want with the DI objects.
"Is there additional documentation or code samples?"
The documentation comes with the package. If you want to
see a live demo of the wizard go under TechSummit in the
B1 home page and watch the B1DE section.
Hi Paolo Fornari
I would say that the main difference is that in you will now be able to use try/catch blocks and that alone is a huge advantage.
If i was you i would go with VS 2005. Programming wise for SAP there is no real huge advantage between VS 2003 or VS 2005. But i myself prefer VS 2005 because there are more nice features like "change code while debugging", "look at array contents by hovering mouse over the array", more colours to distinguish easily and so on.
Hope the above makes your decision EASY!!
😊
... and if you develop in .NET you can download and use
the development and certification tools from SDN. Go
under Business One SDK Tools and download B1DE / B1TE /
B1 DI Event Service / etc
The wizard is based on a set of best practices and will
make your life easier. It has some nice features like:
- automatic generation of metadata code
- automatic generation of menus
- automatic generation of forms
- easier and listener-based event handling
- automatic setup creation
It works for VB.NET and C#. When you download it from SDN
you get also the user documentation and the source code.
Many SDNers are using it and are pretty happy with it.
You can also read some discussion about it in:
1Q.
How do i add form through the wizard once the wizard has finished?
A.
If you want to add a system form in the pool of forms that
can be handled, pls see this thread
If you want to add new forms / menus / listeners after you
have run the wizard you can by following these points:
- right click on your project in the Solution Explorer
- click "Add"
- click "New Item ..."
- select "C# B1 AddOn Component" to add a new form / menu
- select "C# B1 AddOn Listener" to add a new listener in
the menu / form class you have opened in VS.NET
2Q.
Do i need to manage event filters if i use listeners?
A.
No, this is automatically handled by the wizard.
3Q.
The init method of the B1Connections class has parameter 'AddOnIdStr'. If it is blank i runs succefully otherwise i receive 'AddOn identifier is not valid'. Why?
A.
This is the addon Id. You are free not to use it but if
you use it you need to activate the license for it.
4Q. In the OnShutDown should i put some clean up code?
By default it is empty.
A.
Any listener there is empty - you need to add your own
code. If you need to run some code when B1 dies you need
to add this code there. The same is true for the other
listeners.
5Q.
Class B1AddOn1_Db is always necessary?
A.
No, it is used only if you add new metadata objects i.e.
if you add new user tables / user fields / user objects.
If you don't add them the class is generated but it is
empty and you can ignore it.
Q.
I didn'd find a way to add menu items once the project is created.
A.
Once the project is created, all the added menus are contained in an XML. If you
want to add new menus you will have to edit and change this XML.
Q.
How do i attach forms to menus?
A.
You go on the second tab of the wizard - titled Menus - and right click on the menu
you want to attach your form. You can attach an existing form (in XML format) or you
can ask the wizard to generate automatically a form for you starting from an UDO
definition and attach it to the menu.
Q.
Do i have to create one class for each menu item? that would not be to manageble.
A.
You don't create classes, the wizard will create them for you with all the listeners
you specified. The wizard will create a class for each menu you have selected. The
same is true for forms / items: tool creates one class for every form / item you want
to manage. All the listeners for this form / item is part of the class created. You
need to write only your functional code in these callbacks and the framework will take care of registering / routing / filtering events.
If you don't like this way of structuring the code, you could change the code generation part in the wizard source code and regenerate an ad-hoc wizard for you.
About "the no records found" have a look at this thread:
no-records-found-when-using-b1de--2005-sp1-
About user forms: the wizard tries to enforce a model
driven development process in which you define your data
and views are generated out of them. UDO is the key of
all this.
???
I don't know what is going on and it is difficult to guess
anyway:
B1Connections is a singleton object that is created by
the framework. This object has two properties that can
be used to reference the DI connection and the UI
connection. For instance the UI connection can be
accessed with B1Connections.theAppl.
When your listener is called these properties can be used,
actually the wizard itself generates code that use them
like in this sample:
public class Button__139__37 : B1Item { public Button__139__37() { FormType = "139"; ItemUID = "37"; } [B1Listener(BoEventTypes.et_CLICK, false)] public virtual void OnAfterClick(ItemEvent pVal) { bool ActionSuccess = pVal.ActionSuccess; Form form = B1Connections.theAppl.Forms.Item(pVal.FormUID); Item item = form.Items.Item("37"); Button button = ((Button)(item.Specific)); // ADD YOUR ACTION CODE HERE ... } }
Add a comment