Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 697555
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T03:10:49+00:00 2026-05-14T03:10:49+00:00

I am getting ready to take a class at a college on C#. I

  • 0

I am getting ready to take a class at a college on C#. I have been reading up on it a lot and decided to start a fun project.

Here is what my project consists of:

  • Main Control Form
  • Configuration Form
  • Arduino

Program.cs calls Configuration.cs at start. This is where pin modes for the Arduino are set and where a timer is set. When I set these values, they get sent to MainControl.cs. When I hit the “Save” button in Configuration.cs, a MainControl.cs object is created [[I am correct in that?]]

All of those values that were sent by Configuration.cs had corresponding setters that set private static variables in MainControl.cs [[ I don’t really know if that is the preferred way, I am most definetly open to any suggestion anyone has]]

MainControl.cs uses its default constructor, and this constructor calls a method that creates an arduino object from one of the private variables (serialPort) [[ Using this Arduino class Firmata.NET ]]

When the arduino object is created, I know (I guess I do) because the form takes a few seconds to come up (As opposed to not using serial port) My problem is this:

I do not understand why nothing can see the object

I have been very wordy, I apologize if I wasn’t concise. Here is the code:

public partial class CMainControl : Form
{
       private static string serialPort;
        public CMainControl()
    {
        InitializeComponent();
        createArduino();
        updateConfig();  // Change label values to values set in configuration
    }

    private void createArduino()
    {
        Arduino arduino = new Arduino(serialPort);
    }

In Configuration.cs, when I set the serial port through a combobox, the value is sent to MainControl.cs just fine.

Here is the error I get:

Error 1 The name ‘arduino’ does not
exist in the current
context C:\Programming\Visual
Studio\Workhead Demo\Workhead
Demo\CMainControl.cs 94 13 Workhead
Demo

Please let me know if anyone can help and/or offer pointers, and please let me know if I didn’t post or format anything correctly.

Thank you very much 🙂

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T03:10:49+00:00Added an answer on May 14, 2026 at 3:10 am

    Try defining the Arduino variable as field in the CMainControl class.

    public partial class CMainControl : Form
    {
       private Arduino arduino;
       private static string serialPort;
    
        private void createArduino()
        {
            arduino = new Arduino(serialPort);
        }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm getting ready to start a new project and I've been researching the entity
My dev team is getting ready to start a new project. The shop has
I am getting ready to start building a new web project in my spare
I'm getting ready to start work on a new web project for a fairly
I've been getting a lot of blue screens on my XP box at work
We're getting ready to translate our PHP website into various languages, and the gettext
I am getting ready to completely overhaul my web server. I use it for
I'm getting ready to implement a source control system (subversion) but I'm facing some
My organization is getting ready to implement a new system, which is a asp.net
I'm getting ready to release a tool that is only effective with regular hard

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.