In the below Visual Studio 2012 C++ Windows Forms snippet here are several compi
ID: 667074 • Letter: I
Question
In the below Visual Studio 2012 C++ Windows Forms snippet here are several compiler errors in the solution. Identify each compiler error and explain the source of the error and what you can do to fix the error.
#pragma once
#include "City.h"
namespace CPPWinForms {
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 MyMainForm
/// </summary>
public ref class MyMainForm : public System::Windows::Forms::Form
{
public:
MyMainForm(void)
{
InitializeComponent();
//
//TODO: Add the constructor code here
//
}
protected:
/// <summary>
/// Clean up any resources being used.
/// </summary>
~MyMainForm()
{
if (components)
{
delete components;
}
}
private: System::Data::DataSet^ dataSet1;
protected:
/// <summary>
/// Declare two class variables for the departure point
/// and the destination point for one specific flight.
/// </summary>
City departure, destination;
protected:
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->dataSet1 = (gcnew System::Data::DataSet());
(cli::safe_cast<System::ComponentModel::ISupportInitialize^ >(this->dataSet1))->BeginInit();
this->SuspendLayout();
//
// dataSet1
//
this->dataSet1->DataSetName = L"NewDataSet";
//
// MyMainForm
//
this->AutoScaleDimensions = System::Drawing::SizeF(6, 13);
this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
this->ClientSize = System::Drawing::Size(605, 411);
this->Name = L"MyMainForm";
this->Text = L"MyMainForm";
this->Load += gcnew System::EventHandler(this, &MyMainForm::MyMainForm_Load);
(cli::safe_cast<System::ComponentModel::ISupportInitialize^ >(this->dataSet1))->EndInit();
this->ResumeLayout(false);
}
#pragma endregion
private: System::Void MyMainForm_Load(System::Object^ sender, System::EventArgs^ e)
{
// Try to create an exit button:
Button exitButton = new Button();
exitButton.Text = L"Exit";
}
};
}
PLEASE EXPLAIN THE SOURCE OF THE ERROR AND HOW TO FIX IT.
Explanation / Answer
There are no much errors in this code. Found only one error. here is the output of the program when compiled:
City.h is not found ...this is the error
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.