3 Replies - 913 Views - Last Post: 04 September 2015 - 06:18 AM

#1 Scarletward  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 5
  • Joined: 03-September 15

Transferring Information from a Form/GUI to Multiple Separate Classes

Posted 03 September 2015 - 11:50 PM

Hi!

I am sure you get this often, but I am in need of some desperate help. For the last two weeks I have been trying to figure this out. I have an assignment where I have to create a GUI (completed) for a flight ticket kiosk that uses a combination of text-boxes and combo boxes to select city destination (from a list), class (first, business ect.) and number of bags. It has to have separate class files for destinations, passenger info and the final ticket. I am having problems figuring out how to pull the information from the form into the classes and then return it as a final ticket. I am not sure what it is that I am doing wrong, but I was supplied a limited amount of resources that do not cover any of this. I have been searching multiple forums for a while now, but none of the examples or advice I have been given work with Visual Studio 2013 c++.

This is the Form.h It has information from a previous version where I was to calculate all the destinations and costs without classes.

#pragma once
#include "Ticket.h"
#include "Passenger.h"
#include "Destinations.h"

namespace TicketGUI {

	using namespace System;
	using namespace System::Collections;
	using namespace System::Windows::Forms;
	using namespace System::Data;
	using namespace System::Drawing;
	

	/// <summary>
	/// Summary for TGUIForm
	/// </summary>
	public ref class TGUIForm : public System::Windows::Forms::Form
	{
	public:
		TGUIForm(void)
		{
			InitializeComponent();
			//
			//TODO: Add the constructor code here
			//
		}

	protected:
		/// <summary>
		/// Clean up any resources being used.
		/// </summary>
		~TGUIForm()
		{
			if (components)
			{
				delete components;
			}
		}
		

	private: System::Windows::Forms::Label^  label1;
	private: System::Windows::Forms::Panel^  panel1;
	private: System::Windows::Forms::Label^  label4;
	private: System::Windows::Forms::ComboBox^  ToDes;

	private: System::Windows::Forms::Label^  label3;
	private: System::Windows::Forms::ComboBox^  FromDes;

	private: System::Windows::Forms::Label^  label2;
	private: System::Windows::Forms::Panel^  panel2;
	private: System::Windows::Forms::Label^  label6;
	private: System::Windows::Forms::ComboBox^  comboBox3;
	private: System::Windows::Forms::Label^  label5;
	private: System::Windows::Forms::ComboBox^  comboBox5;
	private: System::Windows::Forms::ComboBox^  comboBox4;
	private: System::Windows::Forms::Panel^  panel3;


	private: System::Windows::Forms::Label^  label10;
	private: System::Windows::Forms::Label^  label9;

	private: System::Windows::Forms::Label^  label8;

	private: System::Windows::Forms::Label^  label7;


	private: System::Windows::Forms::Panel^  panel4;
	private: System::Windows::Forms::Label^  label12;

	private: System::Windows::Forms::Label^  label11;
	private: System::Windows::Forms::Button^  Submit;
	private: System::Windows::Forms::Button^  Cancel;


	private: System::Windows::Forms::ComboBox^  ClassSel;

	private: System::Windows::Forms::Panel^  panel5;
	private: System::Windows::Forms::Label^  label13;


	private: System::Windows::Forms::Label^  label14;
 int fromcost;
			 int tocost;
			 int bagcost;
			 int adultcost;
			 int childcost;
			 int classcost;
			 int totalcost;
			 Passenger^ NInfo;
			 Passenger^ YInfo;

	private: System::Windows::Forms::TextBox^  Adults;
	private: System::Windows::Forms::TextBox^  Child;
	private: System::Windows::Forms::TextBox^  Bags;
	private: System::Windows::Forms::TextBox^  NameP;
	private: System::Windows::Forms::Panel^  panel6;
	private: System::Windows::Forms::Label^  label15;
	private: System::Windows::Forms::Label^  label16;
	private: System::Windows::Forms::Label^  label17;
	private: System::Windows::Forms::TextBox^  YOB;




	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)
		{
			System::ComponentModel::ComponentResourceManager^  resources = (gcnew System::ComponentModel::ComponentResourceManager(TGUIForm::typeid));
			this->label1 = (gcnew System::Windows::Forms::Label());
			this->panel1 = (gcnew System::Windows::Forms::Panel());
			this->label4 = (gcnew System::Windows::Forms::Label());
			this->ToDes = (gcnew System::Windows::Forms::ComboBox());
			this->label3 = (gcnew System::Windows::Forms::Label());
			this->FromDes = (gcnew System::Windows::Forms::ComboBox());
			this->label2 = (gcnew System::Windows::Forms::Label());
			this->panel2 = (gcnew System::Windows::Forms::Panel());
			this->comboBox5 = (gcnew System::Windows::Forms::ComboBox());
			this->comboBox4 = (gcnew System::Windows::Forms::ComboBox());
			this->label6 = (gcnew System::Windows::Forms::Label());
			this->comboBox3 = (gcnew System::Windows::Forms::ComboBox());
			this->label5 = (gcnew System::Windows::Forms::Label());
			this->NameP = (gcnew System::Windows::Forms::TextBox());
			this->panel3 = (gcnew System::Windows::Forms::Panel());
			this->Child = (gcnew System::Windows::Forms::TextBox());
			this->Adults = (gcnew System::Windows::Forms::TextBox());
			this->label10 = (gcnew System::Windows::Forms::Label());
			this->label9 = (gcnew System::Windows::Forms::Label());
			this->label8 = (gcnew System::Windows::Forms::Label());
			this->label7 = (gcnew System::Windows::Forms::Label());
			this->panel4 = (gcnew System::Windows::Forms::Panel());
			this->ClassSel = (gcnew System::Windows::Forms::ComboBox());
			this->label12 = (gcnew System::Windows::Forms::Label());
			this->label11 = (gcnew System::Windows::Forms::Label());
			this->Submit = (gcnew System::Windows::Forms::Button());
			this->Cancel = (gcnew System::Windows::Forms::Button());
			this->panel5 = (gcnew System::Windows::Forms::Panel());
			this->Bags = (gcnew System::Windows::Forms::TextBox());
			this->label13 = (gcnew System::Windows::Forms::Label());
			this->label14 = (gcnew System::Windows::Forms::Label());
			this->panel6 = (gcnew System::Windows::Forms::Panel());
			this->YOB = (gcnew System::Windows::Forms::TextBox());
			this->label15 = (gcnew System::Windows::Forms::Label());
			this->label16 = (gcnew System::Windows::Forms::Label());
			this->label17 = (gcnew System::Windows::Forms::Label());
			this->panel1->SuspendLayout();
			this->panel2->SuspendLayout();
			this->panel3->SuspendLayout();
			this->panel4->SuspendLayout();
			this->panel5->SuspendLayout();
			this->panel6->SuspendLayout();
			this->SuspendLayout();
			// 
			// label1
			// 
			this->label1->AutoSize = true;
			this->label1->BackColor = System::Drawing::Color::LightCyan;
			this->label1->BorderStyle = System::Windows::Forms::BorderStyle::Fixed3D;
			this->label1->Font = (gcnew System::Drawing::Font(L"Corbel", 25.8F, static_cast<System::Drawing::FontStyle>((System::Drawing::FontStyle::Bold | System::Drawing::FontStyle::Italic)),
				System::Drawing::GraphicsUnit::Point, static_cast<System::Byte>(0)));
			this->label1->Image = (cli::safe_cast<System::Drawing::Image^>(resources->GetObject(L"label1.Image")));
			this->label1->Location = System::Drawing::Point(12, 22);
			this->label1->Name = L"label1";
			this->label1->Size = System::Drawing::Size(717, 55);
			this->label1->TabIndex = 0;
			this->label1->Text = L"SoarOne Airlines                                           ";
			// 
			// panel1
			// 
			this->panel1->BackColor = System::Drawing::Color::GhostWhite;
			this->panel1->Controls->Add(this->label4);
			this->panel1->Controls->Add(this->ToDes);
			this->panel1->Controls->Add(this->label3);
			this->panel1->Controls->Add(this->FromDes);
			this->panel1->Controls->Add(this->label2);
			this->panel1->Location = System::Drawing::Point(21, 237);
			this->panel1->Name = L"panel1";
			this->panel1->Size = System::Drawing::Size(703, 122);
			this->panel1->TabIndex = 1;
			// 
			// label4
			// 
			this->label4->AutoSize = true;
			this->label4->Font = (gcnew System::Drawing::Font(L"Tahoma", 7.8F, System::Drawing::FontStyle::Bold, System::Drawing::GraphicsUnit::Point,
				static_cast<System::Byte>(0)));
			this->label4->Location = System::Drawing::Point(372, 51);
			this->label4->Name = L"label4";
			this->label4->Size = System::Drawing::Size(31, 17);
			this->label4->TabIndex = 4;
			this->label4->Text = L"To:";
			// 
			// ToDes
			// 
			this->ToDes->FormattingEnabled = true;
			this->ToDes->Items->AddRange(gcnew cli::array< System::Object^  >(5) {
				L"Paris, France", L"Berlin, Germany", L"Dubai, UAE",
					L"New York City, USA", L"Tokyo, Japan"
			});
			this->ToDes->Location = System::Drawing::Point(375, 71);
			this->ToDes->Name = L"ToDes";
			this->ToDes->Size = System::Drawing::Size(121, 24);
			this->ToDes->TabIndex = 3;
			this->ToDes->Text = L"Choose a City";
			this->ToDes->SelectedIndexChanged += gcnew System::EventHandler(this, &TGUIForm::ToDes_SelectedIndexChanged);
			// 
			// label3
			// 
			this->label3->AutoSize = true;
			this->label3->Font = (gcnew System::Drawing::Font(L"Tahoma", 7.8F, System::Drawing::FontStyle::Bold, System::Drawing::GraphicsUnit::Point,
				static_cast<System::Byte>(0)));
			this->label3->Location = System::Drawing::Point(25, 51);
			this->label3->Name = L"label3";
			this->label3->Size = System::Drawing::Size(49, 17);
			this->label3->TabIndex = 2;
			this->label3->Text = L"From:";
			// 
			// FromDes
			// 
			this->FromDes->BackColor = System::Drawing::SystemColors::Info;
			this->FromDes->FormattingEnabled = true;
			this->FromDes->Items->AddRange(gcnew cli::array< System::Object^  >(5) {
				L"Paris, France", L"Berlin, Germany", L"Dubai, UAE",
					L"New York City, USA", L"Tokyo, Japan"
			});
			this->FromDes->Location = System::Drawing::Point(28, 71);
			this->FromDes->Name = L"FromDes";
			this->FromDes->Size = System::Drawing::Size(131, 24);
			this->FromDes->TabIndex = 1;
			this->FromDes->Text = L"Choose a City";
			this->FromDes->SelectedIndexChanged += gcnew System::EventHandler(this, &TGUIForm::FromDes_SelectedIndexChanged);
			// 
			// label2
			// 
			this->label2->AutoSize = true;
			this->label2->BackColor = System::Drawing::SystemColors::GradientActiveCaption;
			this->label2->Font = (gcnew System::Drawing::Font(L"Corbel", 12, static_cast<System::Drawing::FontStyle>((System::Drawing::FontStyle::Bold | System::Drawing::FontStyle::Underline)),
				System::Drawing::GraphicsUnit::Point, static_cast<System::Byte>(0)));
			this->label2->Location = System::Drawing::Point(3, 12);
			this->label2->Name = L"label2";
			this->label2->Size = System::Drawing::Size(708, 24);
			this->label2->TabIndex = 0;
			this->label2->Text = L"Where Do You Want to Go\?                                                         "
				L"                                                           |\r\n";
			// 
			// panel2
			// 
			this->panel2->BackColor = System::Drawing::Color::GhostWhite;
			this->panel2->Controls->Add(this->comboBox5);
			this->panel2->Controls->Add(this->comboBox4);
			this->panel2->Controls->Add(this->label6);
			this->panel2->Controls->Add(this->comboBox3);
			this->panel2->Controls->Add(this->label5);
			this->panel2->Location = System::Drawing::Point(21, 359);
			this->panel2->Name = L"panel2";
			this->panel2->Size = System::Drawing::Size(702, 125);
			this->panel2->TabIndex = 2;
			// 
			// comboBox5
			// 
			this->comboBox5->FormattingEnabled = true;
			this->comboBox5->Items->AddRange(gcnew cli::array< System::Object^  >(5) { L"2015", L"2016", L"2017", L"2018", L"2019" });
			this->comboBox5->Location = System::Drawing::Point(288, 69);
			this->comboBox5->Name = L"comboBox5";
			this->comboBox5->Size = System::Drawing::Size(87, 24);
			this->comboBox5->TabIndex = 3;
			this->comboBox5->Text = L"Year";
			// 
			// comboBox4
			// 
			this->comboBox4->FormattingEnabled = true;
			this->comboBox4->Items->AddRange(gcnew cli::array< System::Object^  >(31) {
				L"1", L"2", L"3", L"4", L"5", L"6", L"7", L"8",
					L"9", L"10", L"11", L"12", L"13", L"14", L"15", L"16", L"17", L"18", L"19", L"20", L"21", L"22", L"23", L"24", L"25", L"26",
					L"27", L"28", L"29", L"30", L"31"
			});
			this->comboBox4->Location = System::Drawing::Point(150, 69);
			this->comboBox4->Name = L"comboBox4";
			this->comboBox4->Size = System::Drawing::Size(80, 24);
			this->comboBox4->TabIndex = 2;
			this->comboBox4->Text = L"Day";
			// 
			// label6
			// 
			this->label6->AutoSize = true;
			this->label6->Font = (gcnew System::Drawing::Font(L"Tahoma", 7.8F, System::Drawing::FontStyle::Bold, System::Drawing::GraphicsUnit::Point,
				static_cast<System::Byte>(0)));
			this->label6->Location = System::Drawing::Point(25, 49);
			this->label6->Name = L"label6";
			this->label6->Size = System::Drawing::Size(119, 17);
			this->label6->TabIndex = 1;
			this->label6->Text = L"Departure Date:";
			// 
			// comboBox3
			// 
			this->comboBox3->FormattingEnabled = true;
			this->comboBox3->Items->AddRange(gcnew cli::array< System::Object^  >(24) {
				L"Jan", L"", L"Feb", L"", L"Mar", L"", L"Apr",
					L"", L"May", L"", L"Jun", L"", L"Jul", L"", L"Aug", L"", L"Sept", L"", L"Oct", L"", L"Nov", L"", L"Dec", L""
			});
			this->comboBox3->Location = System::Drawing::Point(28, 69);
			this->comboBox3->Name = L"comboBox3";
			this->comboBox3->Size = System::Drawing::Size(69, 24);
			this->comboBox3->TabIndex = 0;
			this->comboBox3->Text = L"Month";
			// 
			// label5
			// 
			this->label5->AutoSize = true;
			this->label5->BackColor = System::Drawing::SystemColors::GradientActiveCaption;
			this->label5->Font = (gcnew System::Drawing::Font(L"Corbel", 12, static_cast<System::Drawing::FontStyle>((System::Drawing::FontStyle::Bold | System::Drawing::FontStyle::Underline)),
				System::Drawing::GraphicsUnit::Point, static_cast<System::Byte>(0)));
			this->label5->Location = System::Drawing::Point(2, 3);
			this->label5->Name = L"label5";
			this->label5->Size = System::Drawing::Size(705, 24);
			this->label5->TabIndex = 0;
			this->label5->Text = L"When Do You Want to Go\?                                                          "
				L"                                                            ";
			// 
			// NameP
			// 
			this->NameP->Location = System::Drawing::Point(28, 81);
			this->NameP->Name = L"NameP";
			this->NameP->Size = System::Drawing::Size(74, 24);
			this->NameP->TabIndex = 4;
			this->NameP->TextChanged += gcnew System::EventHandler(this, &TGUIForm::NameP_TextChanged);
			// 
			// panel3
			// 
			this->panel3->BackColor = System::Drawing::Color::GhostWhite;
			this->panel3->Controls->Add(this->Child);
			this->panel3->Controls->Add(this->Adults);
			this->panel3->Controls->Add(this->label10);
			this->panel3->Controls->Add(this->label9);
			this->panel3->Controls->Add(this->label8);
			this->panel3->Controls->Add(this->label7);
			this->panel3->Location = System::Drawing::Point(21, 473);
			this->panel3->Name = L"panel3";
			this->panel3->Size = System::Drawing::Size(703, 142);
			this->panel3->TabIndex = 3;
			// 
			// Child
			// 
			this->Child->Location = System::Drawing::Point(26, 101);
			this->Child->Name = L"Child";
			this->Child->Size = System::Drawing::Size(47, 24);
			this->Child->TabIndex = 8;
			this->Child->TextChanged += gcnew System::EventHandler(this, &TGUIForm::Child_TextChanged);
			this->Child->KeyPress += gcnew System::Windows::Forms::KeyPressEventHandler(this, &TGUIForm::Child_KeyPress);
			// 
			// Adults
			// 
			this->Adults->Location = System::Drawing::Point(26, 60);
			this->Adults->MaxLength = 1;
			this->Adults->Name = L"Adults";
			this->Adults->Size = System::Drawing::Size(48, 24);
			this->Adults->TabIndex = 7;
			this->Adults->TextChanged += gcnew System::EventHandler(this, &TGUIForm::Adults_TextChanged);
			this->Adults->KeyPress += gcnew System::Windows::Forms::KeyPressEventHandler(this, &TGUIForm::Adults_KeyPress);
			// 
			// label10
			// 
			this->label10->AutoSize = true;
			this->label10->Location = System::Drawing::Point(429, 116);
			this->label10->Name = L"label10";
			this->label10->Size = System::Drawing::Size(273, 17);
			this->label10->TabIndex = 5;
			this->label10->Text = L"(Maximum of 6 passengers per reservation)";
			// 
			// label9
			// 
			this->label9->AutoSize = true;
			this->label9->Font = (gcnew System::Drawing::Font(L"Tahoma", 7.8F, System::Drawing::FontStyle::Bold, System::Drawing::GraphicsUnit::Point,
				static_cast<System::Byte>(0)));
			this->label9->Location = System::Drawing::Point(83, 101);
			this->label9->Name = L"label9";
			this->label9->Size = System::Drawing::Size(42, 17);
			this->label9->TabIndex = 4;
			this->label9->Text = L"Child";
			// 
			// label8
			// 
			this->label8->AutoSize = true;
			this->label8->Font = (gcnew System::Drawing::Font(L"Tahoma", 7.8F, System::Drawing::FontStyle::Bold, System::Drawing::GraphicsUnit::Point,
				static_cast<System::Byte>(0)));
			this->label8->Location = System::Drawing::Point(83, 60);
			this->label8->Name = L"label8";
			this->label8->Size = System::Drawing::Size(52, 17);
			this->label8->TabIndex = 2;
			this->label8->Text = L"Adults";
			// 
			// label7
			// 
			this->label7->AutoSize = true;
			this->label7->BackColor = System::Drawing::SystemColors::ActiveCaption;
			this->label7->Font = (gcnew System::Drawing::Font(L"Corbel", 12, static_cast<System::Drawing::FontStyle>((System::Drawing::FontStyle::Bold | System::Drawing::FontStyle::Underline)),
				System::Drawing::GraphicsUnit::Point, static_cast<System::Byte>(0)));
			this->label7->Location = System::Drawing::Point(3, 14);
			this->label7->Name = L"label7";
			this->label7->Size = System::Drawing::Size(803, 24);
			this->label7->TabIndex = 0;
			this->label7->Text = L"How Many Will Be Traveling\?                                                      "
				L"                                                                                "
				L"   ";
			// 
			// panel4
			// 
			this->panel4->BackColor = System::Drawing::Color::GhostWhite;
			this->panel4->Controls->Add(this->ClassSel);
			this->panel4->Controls->Add(this->label12);
			this->panel4->Controls->Add(this->label11);
			this->panel4->Location = System::Drawing::Point(21, 610);
			this->panel4->Name = L"panel4";
			this->panel4->Size = System::Drawing::Size(703, 138);
			this->panel4->TabIndex = 4;
			// 
			// ClassSel
			// 
			this->ClassSel->FormattingEnabled = true;
			this->ClassSel->Items->AddRange(gcnew cli::array< System::Object^  >(3) { L"First Class", L"Business Class", L"Economy Class" });
			this->ClassSel->Location = System::Drawing::Point(18, 65);
			this->ClassSel->Name = L"ClassSel";
			this->ClassSel->Size = System::Drawing::Size(107, 24);
			this->ClassSel->TabIndex = 4;
			this->ClassSel->SelectedIndexChanged += gcnew System::EventHandler(this, &TGUIForm::ClassSel_SelectedIndexChanged);
			// 
			// label12
			// 
			this->label12->AutoSize = true;
			this->label12->Font = (gcnew System::Drawing::Font(L"Tahoma", 7.8F, System::Drawing::FontStyle::Bold, System::Drawing::GraphicsUnit::Point,
				static_cast<System::Byte>(0)));
			this->label12->Location = System::Drawing::Point(131, 68);
			this->label12->Name = L"label12";
			this->label12->Size = System::Drawing::Size(59, 17);
			this->label12->TabIndex = 3;
			this->label12->Text = L"Section";
			this->label12->Click += gcnew System::EventHandler(this, &TGUIForm::label12_Click);
			// 
			// label11
			// 
			this->label11->AutoSize = true;
			this->label11->BackColor = System::Drawing::SystemColors::ActiveCaption;
			this->label11->Font = (gcnew System::Drawing::Font(L"Corbel", 12, static_cast<System::Drawing::FontStyle>((System::Drawing::FontStyle::Bold | System::Drawing::FontStyle::Underline)),
				System::Drawing::GraphicsUnit::Point, static_cast<System::Byte>(0)));
			this->label11->Location = System::Drawing::Point(3, 17);
			this->label11->Name = L"label11";
			this->label11->Size = System::Drawing::Size(760, 24);
			this->label11->TabIndex = 1;
			this->label11->Text = L"How Will You Be Flying\?                                                          "
				L"                                                                               ";
			// 
			// Submit
			// 
			this->Submit->Location = System::Drawing::Point(563, 914);
			this->Submit->Name = L"Submit";
			this->Submit->Size = System::Drawing::Size(66, 30);
			this->Submit->TabIndex = 5;
			this->Submit->Text = L"Submit";
			this->Submit->UseVisualStyleBackColor = true;
			this->Submit->Click += gcnew System::EventHandler(this, &TGUIForm::Submit_Click);
			// 
			// Cancel
			// 
			this->Cancel->Location = System::Drawing::Point(635, 914);
			this->Cancel->Name = L"Cancel";
			this->Cancel->Size = System::Drawing::Size(67, 30);
			this->Cancel->TabIndex = 6;
			this->Cancel->Text = L"Cancel";
			this->Cancel->UseVisualStyleBackColor = true;
			this->Cancel->Click += gcnew System::EventHandler(this, &TGUIForm::Cancel_Click);
			// 
			// panel5
			// 
			this->panel5->BackColor = System::Drawing::Color::GhostWhite;
			this->panel5->Controls->Add(this->Bags);
			this->panel5->Controls->Add(this->label13);
			this->panel5->Controls->Add(this->label14);
			this->panel5->Location = System::Drawing::Point(21, 748);
			this->panel5->Name = L"panel5";
			this->panel5->Size = System::Drawing::Size(703, 132);
			this->panel5->TabIndex = 7;
			// 
			// Bags
			// 
			this->Bags->Location = System::Drawing::Point(29, 59);
			this->Bags->Name = L"Bags";
			this->Bags->Size = System::Drawing::Size(33, 24);
			this->Bags->TabIndex = 5;
			this->Bags->TextChanged += gcnew System::EventHandler(this, &TGUIForm::Bags_TextChanged);
			this->Bags->KeyPress += gcnew System::Windows::Forms::KeyPressEventHandler(this, &TGUIForm::Bags_KeyPress);
			// 
			// label13
			// 
			this->label13->AutoSize = true;
			this->label13->Font = (gcnew System::Drawing::Font(L"Tahoma", 7.8F, System::Drawing::FontStyle::Bold, System::Drawing::GraphicsUnit::Point,
				static_cast<System::Byte>(0)));
			this->label13->Location = System::Drawing::Point(86, 59);
			this->label13->Name = L"label13";
			this->label13->Size = System::Drawing::Size(105, 17);
			this->label13->TabIndex = 3;
			this->label13->Text = L"Checked Bags";
			// 
			// label14
			// 
			this->label14->AutoSize = true;
			this->label14->BackColor = System::Drawing::SystemColors::ActiveCaption;
			this->label14->Font = (gcnew System::Drawing::Font(L"Corbel", 12, static_cast<System::Drawing::FontStyle>((System::Drawing::FontStyle::Bold | System::Drawing::FontStyle::Underline)),
				System::Drawing::GraphicsUnit::Point, static_cast<System::Byte>(0)));
			this->label14->Location = System::Drawing::Point(3, 3);
			this->label14->Name = L"label14";
			this->label14->Size = System::Drawing::Size(823, 24);
			this->label14->TabIndex = 1;
			this->label14->Text = L"How Many Bags Will You Have\?                                                     "
				L"                                                                                "
				L"    ";
			// 
			// panel6
			// 
			this->panel6->BackColor = System::Drawing::Color::GhostWhite;
			this->panel6->Controls->Add(this->YOB);
			this->panel6->Controls->Add(this->NameP);
			this->panel6->Controls->Add(this->label15);
			this->panel6->Controls->Add(this->label16);
			this->panel6->Controls->Add(this->label17);
			this->panel6->Location = System::Drawing::Point(21, 109);
			this->panel6->Name = L"panel6";
			this->panel6->Size = System::Drawing::Size(703, 122);
			this->panel6->TabIndex = 8;
			// 
			// YOB
			// 
			this->YOB->Location = System::Drawing::Point(375, 81);
			this->YOB->MaxLength = 1111;
			this->YOB->Name = L"YOB";
			this->YOB->Size = System::Drawing::Size(58, 24);
			this->YOB->TabIndex = 5;
			this->YOB->TextChanged += gcnew System::EventHandler(this, &TGUIForm::YOB_TextChanged);
			this->YOB->KeyPress += gcnew System::Windows::Forms::KeyPressEventHandler(this, &TGUIForm::YOB_KeyPress);
			// 
			// label15
			// 
			this->label15->AutoSize = true;
			this->label15->Font = (gcnew System::Drawing::Font(L"Tahoma", 7.8F, System::Drawing::FontStyle::Bold, System::Drawing::GraphicsUnit::Point,
				static_cast<System::Byte>(0)));
			this->label15->Location = System::Drawing::Point(372, 51);
			this->label15->Name = L"label15";
			this->label15->Size = System::Drawing::Size(43, 17);
			this->label15->TabIndex = 4;
			this->label15->Text = L"YOB:";
			// 
			// label16
			// 
			this->label16->AutoSize = true;
			this->label16->Font = (gcnew System::Drawing::Font(L"Tahoma", 7.8F, System::Drawing::FontStyle::Bold, System::Drawing::GraphicsUnit::Point,
				static_cast<System::Byte>(0)));
			this->label16->Location = System::Drawing::Point(25, 51);
			this->label16->Name = L"label16";
			this->label16->Size = System::Drawing::Size(53, 17);
			this->label16->TabIndex = 2;
			this->label16->Text = L"Name:";
			// 
			// label17
			// 
			this->label17->AutoSize = true;
			this->label17->BackColor = System::Drawing::SystemColors::GradientActiveCaption;
			this->label17->Font = (gcnew System::Drawing::Font(L"Corbel", 12, static_cast<System::Drawing::FontStyle>((System::Drawing::FontStyle::Bold | System::Drawing::FontStyle::Underline)),
				System::Drawing::GraphicsUnit::Point, static_cast<System::Byte>(0)));
			this->label17->Location = System::Drawing::Point(3, 13);
			this->label17->Name = L"label17";
			this->label17->Size = System::Drawing::Size(711, 24);
			this->label17->TabIndex = 0;
			this->label17->Text = L"Personal Information                                                             "
				L"                                                                     ";
			// 
			// TGUIForm
			// 
			this->AutoScaleDimensions = System::Drawing::SizeF(7, 16);
			this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
			this->BackColor = System::Drawing::Color::LightCyan;
			this->ClientSize = System::Drawing::Size(750, 977);
			this->Controls->Add(this->panel6);
			this->Controls->Add(this->panel5);
			this->Controls->Add(this->Cancel);
			this->Controls->Add(this->Submit);
			this->Controls->Add(this->panel4);
			this->Controls->Add(this->panel3);
			this->Controls->Add(this->panel2);
			this->Controls->Add(this->panel1);
			this->Controls->Add(this->label1);
			this->Name = L"TGUIForm";
			this->Text = L"SoarOne Airline";
			this->Load += gcnew System::EventHandler(this, &TGUIForm::TGUIForm_Load);
			this->panel1->ResumeLayout(false);
			this->panel1->PerformLayout();
			this->panel2->ResumeLayout(false);
			this->panel2->PerformLayout();
			this->panel3->ResumeLayout(false);
			this->panel3->PerformLayout();
			this->panel4->ResumeLayout(false);
			this->panel4->PerformLayout();
			this->panel5->ResumeLayout(false);
			this->panel5->PerformLayout();
			this->panel6->ResumeLayout(false);
			this->panel6->PerformLayout();
			this->ResumeLayout(false);
			this->PerformLayout();

		}
		
#pragma endregion
private: System::Void TGUIForm_Load(System::Object^  sender, System::EventArgs^  e) {
	Passenger^ nPassenger = gcnew Passenger(); 
	/*nPassenger->NInfo = NameP->Text;
	nPassenger->YInfo = YOB->Text; */              //Error shows here

	
}
		//Calculations made when the submit button is pressed 

private: System::Void Submit_Click(System::Object^  sender, System::EventArgs^  e) {
	String^ fromval = FromDes->Text;
	String^ toval = ToDes->Text;
	String^ passen = Adults->Text;
	String^ ctype = ClassSel->Text;
	String^ cpassen = Child->Text;
	String^ getName = NameP->Text;
	int totalcost = fromcost += tocost += classcost += bagcost += childcost += adultcost;
	MessageBox::Show("Hello " + ", you are traveling from " + fromval + " to " + toval + " in " + ctype + ", with " + passen + " adults and " + cpassen + " child. The total is " + totalcost + " USD");
	;

}		//Origin city
private: System::Void FromDes_SelectedIndexChanged(System::Object^  sender, System::EventArgs^  e) {
	if (FromDes-> Text == "Paris, France") 
		fromcost = 500;
	else if (FromDes-> Text == "Berlin, Germany")
		fromcost = 450;
	else if (FromDes->Text == "Dubai, UAE")
		fromcost = 1000;
	else if (FromDes->Text == "New York City, USA")
		fromcost = 350;
	else if (FromDes->Text == "Tokyo, Japan")
		fromcost = 950;
		

}
		 //Destination city
private: System::Void ToDes_SelectedIndexChanged(System::Object^  sender, System::EventArgs^  e) {
	if (ToDes->Text == "Paris, France")
		tocost = 500;
	else if (ToDes->Text == "Berlin, Germany")
		tocost = 450;
	else if (ToDes->Text == "Dubai, UAE")
		tocost = 1000;
	else if (ToDes->Text == "New York City, USA")
		tocost = 350;
	else if (ToDes->Text == "Tokyo, Japan")
		tocost = 950;
	
}


		
		 //Type of Class
private: System::Void ClassSel_SelectedIndexChanged(System::Object^  sender, System::EventArgs^  e) {
	if (ClassSel->Text == "First Class")
		classcost = 1000;
	else if (ClassSel->Text == "Business Class")
		classcost = 700;
	else if (ClassSel->Text == "Economy Class")
		classcost = 500;

}

		
private: System::Void label12_Click(System::Object^  sender, System::EventArgs^  e) {
}



		 //Exit Button

private: System::Void Cancel_Click(System::Object^  sender, System::EventArgs^  e) {

	Close();
}


		//Adult Ticket Text Box
private: System::Void Adults_TextChanged(System::Object^  sender, System::EventArgs^  e) {
	if (Adults->Text == "1")
		childcost = 50;
	else if (Adults->Text == "2")
		childcost = 100;
	else if (Adults->Text == "3")
		childcost = 150;
	else if (Adults->Text == "4")
		childcost = 200;
	
}
		//Adult Tickt Numerical Limitation
private: System::Void Adults_KeyPress(System::Object^  sender, System::Windows::Forms::KeyPressEventArgs^  e) {
	if (!Char::IsDigit(e->KeyChar) && e->KeyChar != 0x08)
		e->Handled = true;
}

		 //Child Ticket Numerical Limitation
private: System::Void Child_KeyPress(System::Object^  sender, System::Windows::Forms::KeyPressEventArgs^  e) {

	if (!Char::IsDigit(e->KeyChar) && e->KeyChar != 0x08)
		e->Handled = true;
}
		 //Child Ticket Text Box
private: System::Void Child_TextChanged(System::Object^  sender, System::EventArgs^  e) {
	if (Child->Text == "1")
	adultcost = -50;
	else if (Child->Text == "2")
	adultcost = -100;
	else if (Child->Text == "3")
	adultcost = -150;
	else if (Child->Text == "4")
	adultcost = -200;
}
		//Bags Text Box
private: System::Void Bags_TextChanged(System::Object^  sender, System::EventArgs^  e) {
	 if (Bags->Text == "1")
	bagcost = 10;
	else if (Bags->Text == "2")
	bagcost = 20;
	else if (Bags->Text == "3")
	bagcost = 30;
	else if (Bags->Text == "4")
	bagcost = 40; 
}

		 //Bags Numerical Limitation
private: System::Void Bags_KeyPress(System::Object^  sender, System::Windows::Forms::KeyPressEventArgs^  e) {
	if (!Char::IsDigit(e->KeyChar) && e->KeyChar != 0x08)
		e->Handled = true;

}

		 

private: System::Void NameP_TextChanged(System::Object^  sender, System::EventArgs^  e) {
	
}
private: System::Void YOB_KeyPress(System::Object^  sender, System::Windows::Forms::KeyPressEventArgs^  e) {
	if (!Char::IsDigit(e->KeyChar) && e->KeyChar != 0x08)
		e->Handled = true;
}
private: System::Void YOB_TextChanged(System::Object^  sender, System::EventArgs^  e) {

}

};
}






This is the Passenger.h

#pragma once
/*#include <iostream>
#include <string>*/
#include "TGUIForm.h"

#ifndef PASSENGER_H
#define PASSENGER_H

using namespace System;
public ref class Passenger
{
private:
	String^ Nm;
	String^ Yr;
	

	public:

		Passenger(){
		};

		Passenger(String^, String^);

		String^ NInfo(void);
		String^ YInfo(void);
};
#endif






The Passenger.cpp

#include "Passenger.h"
#include "TGUIForm.h"


using namespace System;

Passenger::Passenger(String^ name, String^ YOB){
	Nm = name;
	Yr = YOB;
}

String^ Passenger::NInfo(void){
	return Nm;
}
String^Passenger::YInfo(void){
	return Yr;
}





If you can give me some pointers or different examples (I work best with visual examples) for this one class, I am sure I can figure it out with the rest. I am sorry if the code is a little mangled; I have been messing with it for a while and occasionally loose track of what it is I am working on. I went ahead and attached the actual file .zip if you need it.

Thank you! Hope to hear from someone soon before my head explodes. :surrender:

Attached File(s)



Is This A Good Question/Topic? 0
  • +

Replies To: Transferring Information from a Form/GUI to Multiple Separate Classes

#2 snoopy11  Icon User is offline

  • Engineering ● Software
  • member icon

Reputation: 1295
  • View blog
  • Posts: 3,970
  • Joined: 20-March 10

Re: Transferring Information from a Form/GUI to Multiple Separate Classes

Posted 04 September 2015 - 12:34 AM

This is CLI/C++

so I am moving it to to that forum.

Regards

Snoopy.
Was This Post Helpful? 0
  • +
  • -

#3 Scarletward  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 5
  • Joined: 03-September 15

Re: Transferring Information from a Form/GUI to Multiple Separate Classes

Posted 04 September 2015 - 12:44 AM

Thanks! I thought that was where I was. Oops!
Was This Post Helpful? 0
  • +
  • -

#4 Scarletward  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 5
  • Joined: 03-September 15

Re: Transferring Information from a Form/GUI to Multiple Separate Classes

Posted 04 September 2015 - 06:18 AM

Any advice would be great. Is there something I am forgetting to mention? I am basically asking for help on pulling a value from a form text/combo box into separate class files. I have been unable to find any sources that would work.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1