Welcome to Synthiam!

Program robots using technologies created from industry experts. ARC is our free-to-use robot programming software that makes features like vision recognition, navigation and artificial intelligence easy.

Get Started
United Kingdom
Asked — Edited

Multiple Forms Ezb.Connect1 Problems

Hi Guys

Im trying to create multiple forms with the EZ B connection on Form 1 (Home page). On Form 2 I have a button to activate digital port D19. I'm using the code below:

ezB_Connect1.EZB.Digital.SetDigitalPort(EZ_B.Digital.DigitalPortEnum.D19, false);

However I am getting the error:

The name 'ezB_Connect1 does not exist in the current context.

I've experimentaed with the code in Tutorial 22 - Multiple Forms. But to no avail.

Iv'e also changed the visiibilty of the EZ_B.Connect1 property to public.

Anyone any ideas?



In the example programs that DJ gives, under downloads SDK, one called multiple Forms. you need to pass the ez_b.connect1.ezb to second form.

you now use the ezb delared in second form as ez_b.connect1.ezb


is now
United Kingdom
Hi orwnic82

Thanks for the reply

I'm a newcomer to c# and still getting my head around the terms. when you say 'pass' what does that entail?


By pass what your doing is allowing the second form access to the methods/classes that are provided on the first form. If you look over the example DJ provides there is a line on the first form that states something to this extent:
Form2 f2;
f2 = new Form2(ezB_Connect1.EZB);

the first line defines the term f2 as Form2 which is the second form of the project //unless you named the forms different

the second line declares f2 to be a new form passing the contents of the connection of the ez-b

f2.Show(); will simply enable the second form window to show

in the second form you'll have to edit the public Form2()
which contains the Initailization of the form
declare a global variable of
EZB _ezb = new EZB();
public Form2(EZB ezb)
_ezb = ezb;

here your enabling form2 access to the ezb_connect1.ezb
and producing as _ezb, instead of calling it up as ezb_connect1.ezb in the second form you'll be using _ezb

Hope that helps a bit, keep on coding.
United Kingdom
Hi orwnic82,

Can't thank you enough. Got it to work!! Brilliant!

Changed the line to:

_ezb.Digital.SetDigitalPort(EZ_B.Digital.DigitalPortEnum.D19, false);

Many thanks!

No problem,
Helping a fellow robotic enthusiest.
Have fun creating your interface and hope to see what it looks like when you have it completed.