Event creation in VB
Sébastien Danober
Hello,I'm having trouble to find the right way to handle event in VB Code. All the samples I've seen were in C#.
I Creted a button on the sale order form, and now I just wanted to catch the event to launch a function. I saw the C# sharp would be similar to he code below, but I cannot find the way to "translate" it to VB.
Can you please show me an example ?
I know that for this specific case, I can use the Function button, but I need to understand how it works.
Thank you
customize.UI.EventHandling.ItemEvents.ItemPressed evMyButton = null;
evMyButton = delegate (customize.UI.EventHandling.ItemEvents.Click ev)
{
StatusBar.WriteError("test");
};
((Button) pVal.Form.Items["MyButtonUID"]).AddHandler_ItemPressed (customize.UI.Components.ModeComponent.FormModes.ALL, evMyButton);
Manuel Marhold
Hi,use this: http://labs.developerfusion.co.uk/convert/csharp-to-vb.aspx
Sébastien Danober
hello Manuelthank you for your help. unfortunately, the generated code is not working with coresuite.
I cannot find a way to ha a VB code similar to create the function in the event.
Bart De Cattelle
I have the same problem.Can someone provide the example in vb.net please?
Kind regards.
Anders Olsson
Hi Bart,As far as I know, VB doesn't support anonymous methods. Either use C# for these scenarios or place your event handler in the global code section ("Extended Code") and attach that to the click event.
Regards,
Anders Olsson
Philipp Knecht
Hi Bartjust an idea:
It could help if you create optimizer rules which are configured for your own form.
hth
0
Please sign in to leave a comment.
Comments
0 comments