Norway
Asked — Edited

Controls In A New Form?

Hi DJ! After a couple of hours programming in Visual C# I was wondering if it was possible to send commands (for example set servoposition) from another form than the main form containing the ezb-connect.

Hope you understand what I'm trying to do:P Have the main form display the connect to ezb, and a button to open a new form where there are buttons to control servos.

Thank you :-)

  • Mix3rn


ARC Pro

Upgrade to ARC Pro

Subscribe to ARC Pro, and your robot will become a canvas for your imagination, limited only by your creativity.

#2  

All of my programming experience is from VB6, so I can't tell you how to do it in c# yet (I plan on getting a book or taking a class) but I can affirm what you want to do is certainly possible. In vb6, you woukd add the control to one form (lets say form1) and if you wanted to use it from another form, you would use form1 as the first part of the control name.

Ie.

Rc = form1.control1.method(parameter1,parapmeter2,etc) If rc = 0 "success" Else "failure" Endif

Alan

PRO
Synthiam
#3  

Hey there!

Add the EZ-B Connect control. Look through the property panel for the control and set it to PUBLIC.

From another form, you can now reference that form's public objects (ez-b connect being one of them)

You may have to pass an instance of the form (this) to the other form.:)

Norway
#4  

Didn't fully understand that, sorry confused

User-inserted image

Do you have a code example to my project`?

Thank you very much!

PRO
Synthiam
#5  

I'll make one and put it in the sdk package. i'll reply to this thread when it's up. i can do it tomorrow day

PRO
Synthiam
#7  

Check out Tutorial 22 in the latest SDK (v2011.10.03.00)