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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T23:29:38+00:00 2026-06-07T23:29:38+00:00

So I am writing a Windows Form App, and so when I run it

  • 0

So I am writing a Windows Form App, and so when I run it it throws an error that it should not be throwing. It throws a “Syntax Error :Missing ; Before using”

I tried putting one on the previous line and it did not work.

The File In Question is this

// Rock Paper Scisors.cpp : main project file.

#include "stdafx.h"
#include "Form1.h"

using namespace RockPaperScisors;

[STAThreadAttribute]
int main(array<System::String ^> ^args)
{
    // Enabling Windows XP visual effects before any controls are created
    Application::EnableVisualStyles();
    Application::SetCompatibleTextRenderingDefault(false); 

    // Create the main window and run it
    Application::Run(gcnew Form1());
    return 0;
}}

stdafx.h is part of MS Visual C++ Express, anyway, The code for Form1.h can be found at this pastebin (didn’t want to flood up the entire stack overflow page.) http://pastebin.com/324mpCps

All 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-07T23:29:42+00:00Added an answer on June 7, 2026 at 11:29 pm

    You just confused with the brackets.

    Firstly, remove the last ‘}’ in Rock Paper Scisors.cpp file. Secodnly, this is how the correct Form1.h file should look:

    #include<time.h>
    #include<stdlib.h>
    #include<stdio.h>
    #include<ctime>
    #include<cstdlib>
    
    #pragma once
    
    namespace RockPaperScisors {
    
        using namespace System;
        using namespace System::ComponentModel;
        using namespace System::Collections;
        using namespace System::Windows::Forms;
        using namespace System::Data;
        using namespace System::Drawing;
    
        /// <summary>
        /// Summary for Form1
        /// </summary>
        public ref class Form1 : public System::Windows::Forms::Form
        {
        public:
            Form1(void)
            {
                InitializeComponent();
                //
                //TODO: Add the constructor code here
                //
            }
    
        protected:
            /// <summary>
            /// Clean up any resources being used.
            /// </summary>
            ~Form1()
            {
                if (components)
                {
                    delete components;
                }
            }
        private: System::Windows::Forms::Button^  Rock;
        protected: 
        private: System::Windows::Forms::Button^  Paper;
        private: System::Windows::Forms::Button^  cis;
        private: System::Windows::Forms::TextBox^  ComBox;
    
        private: System::Windows::Forms::TextBox^  WonBox;
        private: System::Windows::Forms::Label^  CompLabel;
    
    
        private: System::Windows::Forms::Label^  WonLabel;
    
    
        private:
            /// <summary>
            /// Required designer variable.
            /// </summary>
            System::ComponentModel::Container ^components;
    
    #pragma region Windows Form Designer generated code
            /// <summary>
            /// Required method for Designer support - do not modify
            /// the contents of this method with the code editor.
            /// </summary>
            void InitializeComponent(void)
            {
                this->Rock = (gcnew System::Windows::Forms::Button());
                this->Paper = (gcnew System::Windows::Forms::Button());
                this->cis = (gcnew System::Windows::Forms::Button());
                this->ComBox = (gcnew System::Windows::Forms::TextBox());
                this->WonBox = (gcnew System::Windows::Forms::TextBox());
                this->CompLabel = (gcnew System::Windows::Forms::Label());
                this->WonLabel = (gcnew System::Windows::Forms::Label());
                this->SuspendLayout();
                // 
                // Rock
                // 
                this->Rock->Location = System::Drawing::Point(13, 33);
                this->Rock->Name = L"Rock";
                this->Rock->Size = System::Drawing::Size(75, 23);
                this->Rock->TabIndex = 0;
                this->Rock->Text = L"Rock";
                this->Rock->UseVisualStyleBackColor = true;
                this->Rock->Click += gcnew System::EventHandler(this, &Form1::Rock_Click);
                // 
                // Paper
                // 
                this->Paper->Location = System::Drawing::Point(94, 33);
                this->Paper->Name = L"Paper";
                this->Paper->Size = System::Drawing::Size(75, 23);
                this->Paper->TabIndex = 0;
                this->Paper->Text = L"Paper";
                this->Paper->UseVisualStyleBackColor = true;
                this->Paper->Click += gcnew System::EventHandler(this, &Form1::Paper_Click);
                // 
                // cis
                // 
                this->cis->Location = System::Drawing::Point(175, 33);
                this->cis->Name = L"cis";
                this->cis->Size = System::Drawing::Size(75, 23);
                this->cis->TabIndex = 0;
                this->cis->Text = L"Scisors";
                this->cis->UseVisualStyleBackColor = true;
                this->cis->Click += gcnew System::EventHandler(this, &Form1::cis_Click);
                // 
                // ComBox
                // 
                this->ComBox->Location = System::Drawing::Point(83, 127);
                this->ComBox->Name = L"ComBox";
                this->ComBox->Size = System::Drawing::Size(100, 20);
                this->ComBox->TabIndex = 1;
                // 
                // WonBox
                // 
                this->WonBox->Location = System::Drawing::Point(83, 190);
                this->WonBox->Name = L"WonBox";
                this->WonBox->Size = System::Drawing::Size(100, 20);
                this->WonBox->TabIndex = 2;
                // 
                // CompLabel
                // 
                this->CompLabel->AutoSize = true;
                this->CompLabel->Location = System::Drawing::Point(91, 95);
                this->CompLabel->Name = L"CompLabel";
                this->CompLabel->Size = System::Drawing::Size(88, 13);
                this->CompLabel->TabIndex = 3;
                this->CompLabel->Text = L"Computer Choice";
                // 
                // WonLabel
                // 
                this->WonLabel->AutoSize = true;
                this->WonLabel->Location = System::Drawing::Point(91, 163);
                this->WonLabel->Name = L"WonLabel";
                this->WonLabel->Size = System::Drawing::Size(62, 13);
                this->WonLabel->TabIndex = 3;
                this->WonLabel->Text = L"Who Won\?";
                // 
                // Form1
                // 
                this->AutoScaleDimensions = System::Drawing::SizeF(6, 13);
                this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
                this->ClientSize = System::Drawing::Size(284, 262);
                this->Controls->Add(this->WonLabel);
                this->Controls->Add(this->CompLabel);
                this->Controls->Add(this->WonBox);
                this->Controls->Add(this->ComBox);
                this->Controls->Add(this->cis);
                this->Controls->Add(this->Paper);
                this->Controls->Add(this->Rock);
                this->Name = L"Form1";
                this->Text = L"Form1";
                this->ResumeLayout(false);
                this->PerformLayout();
    
            }
    #pragma endregion
        int userChoice, compChoice;
    private: System::Void Rock_Click(System::Object^  sender, System::EventArgs^  e) 
             {
                 ComBox->Text="";
                 userChoice=1;
    
            compChoice=rand()%3+1;
    
                switch(compChoice)
                {
                case 1:
                    ComBox->Text="Rock";
                    WonBox->Text="You Tied";
                    break;
                case 2:
                    ComBox->Text="Paper";
                    WonBox->Text="You Lost";
                    break;
                case 3:
                    ComBox->Text="Scisors";
                    WonBox->Text="You Won";
                    break;
                }
    
             }
    private: System::Void Paper_Click(System::Object^  sender, System::EventArgs^  e) {
                 ComBox->Text="";
                 userChoice=2;
            compChoice=rand()%3+1;
    
                switch(compChoice){
                case 1:
                    ComBox->Text="Rock";
                    WonBox->Text="You Won";
                    break;
                case 2:
                    ComBox->Text="Paper";
                    WonBox->Text="You Tied";
                    break;
                case 3:
                    ComBox->Text="Scisors";
                    WonBox->Text="You Lost!";
                    break;
                }
             }
    private: System::Void cis_Click(System::Object^  sender, System::EventArgs^  e) {
                 ComBox->Text="";
                 userChoice=3;
                compChoice=rand()%3+1;
    
    
                switch(compChoice){
                case 1:
                    ComBox->Text="Rock";
                    WonBox->Text="You Lost";
                    break;
                case 2:
                    ComBox->Text="Paper";
                    WonBox->Text="You Won";
                    break;
                case 3:
                    ComBox->Text="Scisors";
                    WonBox->Text="You Tied!";
                    break;
                }
    }  //The culprit!
    };
    }
    

    I’ve only added one bracket near the end,closing the last method in class. Since Visual Studio 2010 and earlier don’t support the IntelliSense in C++/CLI, bugs are likely to occur in such projects.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm writing a Windows Form app that uses an API (the smartFOCUS API, to
I am writing this app in windows form c#. When user exit from this
I have a Windows/Apache2/PHP app that receives file using chunked encoding. The reason is
I'm writing a Windows Forms app in C#, using Visual Studio 2010. It has
I am writing a windows forms app that can launch a console for debugging.
I'm writing trying to write a SSH client. Im using the windows forms NOT
I'm trying to include in my Windows Form App a way that when user
I'm writing an app that has a wizard type input section. Think MS Windows
I'm using visual stduio 2008 c++. And I'm writing windows form application. I declare
I'm writing a Windows Form Application, that makes extensive use of datagridview and others

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.