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
Asked — Edited

Anyone Good At C#, How Can I Build A Menu, Please ??

I did not get very far with c#. Does anyone know how to build a menu. I wish to have a window and have seven buttons and have it return to this menu. I got one button only from the example Customizing C#. My programs don't seem to compile because I am not using the proper syntax and guess.

Anyway,

Thanks in Advance.

Mel

#1  
Start New Project create a Windows Form Application, name as like. Next use toolbox, under view if not located on your left hand side of Visual Studios. Use all windows form and search for button. double click button to add to layout, position the way you like it. If you double click the button it will create the instance for a button press in the code. From there you have to input the code you wish to activate from the occurance of a button press. To change the text on the button, on Form1.cs[design] where you place your layout click once on the button, should notice properties on the right bottom. look for TEXT: and replace "button 1" with what you want it labeled with.
#2  
Note you will have to tabs open Form1.cs and Form1.cs[Design], design is where your layout for your window is and other is for code.


User-inserted image


Double clicking the button will create:

private void button2_Click(object sender, EventArgs e)
{
//Code places inside brackets
}
#3  
Ok now to get into adding EZ-B.dll, this is downloaded into your folder EZ-Robot under c:\program files. in the Solution Explore, note location via picture above properties right click on references, add reference. go to browse and locate EZ-B.dll in the EZ-Robot folder under ARC Installer, the extension may not be stated. Double click and add. Next in your code Form1.cs scroll to the top your see: using System statement. under them, next line, add using EZ-B; . Next you can add the tools that DJ has created for interface with c# programmers. Open the toolbox right click inside the toolbox area but not next to any of the tool already existing. Should see add tab click on, name it ez-b for ease. Once created right click on the tab you created and click choose items, browse once again for the .dll file once found click and add should see two ez-b files located in window then press ok. Now that that is done you have couple new tools. EZB_Connect is a serial interface for connecting to the ez-b. One step more, go up to the top of visual studios and click on Debug then Exceptions. Now drop down Managed Debugging Assitants and locate Loaderlock uncheck Thrown, should be the only option checked.
#4  
One more case, I am not sure if DJ has updated the Net frame work but I always set mine to .net framework 3.5 to do this click on tan project then select (ProjectName) properties. ******Also do not name your project EZ-B or any variance of it you might end up mixing yourself up coding wise do to the namespace being the same as some of the field or methods. ******* Back on topic, in the properties there is the target framework change to .net 3.5 framework. Now all that should be left is coding.


Link for SDK fields and Methods
#5  
Thanks for the advice. Friday I will give it a try.

I took msstudio off my system because I never could get it to work.

I was trying for an easier to work with compiler.

I had figured if I found the code that was simple, i could include it in the C# script section that D.J. has intergrated.

Thanks for your support.


Mel:D :D :D
#6  
Just ask when you get to it. I haven't done to much using DJ's methods and fields besides using I2C, servo driving and ADC ports but I don't think the other ones should be to hard to implement. DJ has the orginization done packed with coding so. C# coding gives you much more options you can work with besides what the ez-b has to offer so there are more options, things like the time date functions and the twitter all are c# functioned and only pass results to the modules when pompted through ez-b's com lines. Always willing to help branch other off into building their own code, gets you further into knowing how to make your own devices and work with other micros so.
#7  
Thank You, Orwnic82. I may try that if you are around to help.

Mel :D