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 8676609
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T20:14:23+00:00 2026-06-12T20:14:23+00:00

I am having another issue writing my chip8 Emu. I have managed to get

  • 0

I am having another issue writing my chip8 Emu. I have managed to get all instructions working aside from those that require input or those that involve graphics.

I am trying to write a seperate class to simply determine whether a button is being pressed or not. I have been working on this for some time and I think that I must be missing something very simple or I do not understand something conceptually. Here is the class I am writing with the exact errors in the comments

using System;
 using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace WindowsFormsApplication1
{
    class userIn
{
    bool pressed = false;
    public userIn()
    {

    }

    public bool checkPress() //Error    9   'WindowsFormsApplication1.userIn.checkPress()': not all code paths return a value   C

    {  //<---- it is teling me that a closing bracket is expected here?
         private void key5_Click(object sender, EventArgs e)
    {
             pressed = true;
    }

    private void keyb_Click(object sender, EventArgs e)
    {
        pressed = true;
    }

    private void key0_Click(object sender, EventArgs e)
    {
        pressed = true;
    }

    private void keya_Click(object sender, EventArgs e)
    {
        pressed = true;
    }

    private void keye_Click(object sender, EventArgs e)
    {
        pressed = true;
    }

    private void key9_Click(object sender, EventArgs e)
    {
        pressed = true;
    }

    private void key8_Click(object sender, EventArgs e)
    {
        pressed = true;
    }

    private void key7_Click(object sender, EventArgs e)
    {
        pressed = true;
    }

    private void keyd_Click(object sender, EventArgs e)
    {
        pressed = true;
    }

    private void keyf_Click(object sender, EventArgs e)
    {
        pressed = true;
    }

    private void key6_Click(object sender, EventArgs e)
    {
        pressed = true;
    }

    private void key4_Click(object sender, EventArgs e)
    {
        pressed = true;
    }

    private void keyc_Click(object sender, EventArgs e)
    {
        pressed = true;
    }

    private void key3_Click(object sender, EventArgs e)
    {
        pressed = true;
    }

    private void key2_Click(object sender, EventArgs e)
    {
        pressed = true;
    }

    private void key1_Click(object sender, EventArgs e)
    {
        pressed = true;
    }


        return pressed; //Error 6   Invalid token 'return' in class, struct, or interface member declaration    

    }
}

} // Error 8 Type or namespace definition, or end-of-file expected

Last line would not fit in the box

Does anyone have any Ideas or suggestions?

As always any help is appreciated!

  • 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-06-12T20:14:24+00:00Added an answer on June 12, 2026 at 8:14 pm

    } for checkPress method comes in end of class, your correct method:

    public bool checkPress()
    { 
        return pressed; 
    }
    

    and your code should be like this:

    using System;
    ...
    
    namespace WindowsFormsApplication1
    {
        class userIn
        {
            bool pressed = false;
            public userIn()
            {
    
            }
    
            public bool checkPress() // This method
            {
                return pressed;
            } // Must close here, not end of class
    
            .
            . 
            .
    
            private void key1_Click(object sender, EventArgs e)
            {
                pressed = true;
            }
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm having an issue with backbone.js' models. I have a view that creates another
I've run into another issue while writing this code (with MUCH help from programmers
Having another issue, and this one is BAFFLING! Here we go. We have a
I'm writing a plug-in for another program in C#.NET, and am having performance issues
I'm having an issue with an expanding div tag that is nested within another
As many of you may already know I have been having issues with another
Have another issue here. Our app starts out with a tab activity. But, before
I'm having another iOS related issue. This time relating to addSubView on a UIView.
We are moving from another issue tracking platform to Jira. How could i set
I'm having the strangest issue... I have a monorail website (a .NET solution, similar

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.