GIDForums  

Go Back   GIDForums > Computer Programming Forums > MS Visual C++ / MFC Forum
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
 
Thread Tools Search this Thread Rate Thread
  #1  
Old 01-Jun-2006, 07:02
gohan2091 gohan2091 is offline
New Member
 
Join Date: May 2006
Posts: 10
gohan2091 is on a distinguished road
Question

Can someone look through my code?


I am in the process of making a program in Microsoft Visual Studio 2003 for a college project. The program is very basic and it is about 50% completed.

Basically you enter your details in the text boxes towards the right, and then click the enter button. A seat towards the right (one of the 10 labels) will display your first and second name. Double clicking a booked seat will display details in the text boxes at the bottom of the window.

That is all I want so far and I have written the code but I am getting errors. I am new to programming and I made this program by copying a similar program (teacher said this is fine) and changing the code as well as adding extra things.

Could someone have a look at my program and fix the errors for me please? Ignore the design, I know everything is misaligned, I will fix that later, I just want the program working. I dont want code rewritten, I would like it exactly how it is because this is the only way I understand.

I have uploaded my program http://homepage.ntlworld.com/stephanie.mirza/AlphaJet's%20Booking%20System.zip

I dont understand the code well enough to make big changes, please can someone help?
  #2  
Old 01-Jun-2006, 22:24
gohan2091 gohan2091 is offline
New Member
 
Join Date: May 2006
Posts: 10
gohan2091 is on a distinguished road

Re: Can someone look through my code?


When I try and run the program, I first of all get this....

http://homepage.ntlworld.com/stepha...ent%20Error.JPG

and then I get 4 errors

http://homepage.ntlworld.com/stepha...03%20error1.JPG
  #3  
Old 04-Jun-2006, 18:46
Johnny Johnny is offline
New Member
 
Join Date: May 2006
Posts: 27
Johnny is on a distinguished road

Re: Can someone look through my code?


Quote:
------ Build started: Project: AlphaJet's Booking System, Configuration: Release Win32 ------
Compiling...
stdafx.cpp
Compiling...
FrmBookingSystem.cpp
c:\documents and settings\kapow\desktop\alphajet's booking system\FrmBookingSystem.h(2 : error C2059: syntax error : '['
c:\documents and settings\kapow\desktop\alphajet's booking system\FrmBookingSystem.h(43) : error C3867: 'AlphaJetsBookingSystem::FrmBookingSystem::lblSeat 1_Click': function call missing argument list; use '&AlphaJetsBookingSystem::FrmBookingSystem::lblSea t1_Click' to create a pointer to member
c:\documents and settings\kapow\desktop\alphajet's booking system\FrmBookingSystem.h(43) : error C3350: 'System::EventHandler' : a delegate constructor expects 2 argument(s)
c:\documents and settings\kapow\desktop\alphajet's booking system\FrmBookingSystem.h(462) : error C3867: 'AlphaJetsBookingSystem::FrmBookingSystem::lblSeat 1_Click': function call missing argument list; use '&AlphaJetsBookingSystem::FrmBookingSystem::lblSea t1_Click' to create a pointer to member
c:\documents and settings\kapow\desktop\alphajet's booking system\FrmBookingSystem.h(462) : error C3350: 'System::EventHandler' : a delegate constructor expects 2 argument(s)
c:\documents and settings\kapow\desktop\alphajet's booking system\FrmBookingSystem.h(621) : error C3867: 'AlphaJetsBookingSystem::FrmBookingSystem::btnEnte r_Click': function call missing argument list; use '&AlphaJetsBookingSystem::FrmBookingSystem::btnEnt er_Click' to create a pointer to member
c:\documents and settings\kapow\desktop\alphajet's booking system\FrmBookingSystem.h(621) : error C3350: 'System::EventHandler' : a delegate constructor expects 2 argument(s)
c:\documents and settings\kapow\desktop\alphajet's booking system\FrmBookingSystem.h(880) : error C2660: 'AlphaJetsBookingSystem::FrmBookingSystem:asseng erType:assengerType' : function does not take 5 arguments
c:\documents and settings\kapow\desktop\alphajet's booking system\FrmBookingSystem.h(88 : error C2039: 'firstName' : is not a member of 'System::Windows::Forms::Label'
c:\windows\microsoft.net\framework\v2.0.50727\syst em.windows.forms.dll : see declaration of 'System::Windows::Forms::Label'
c:\documents and settings\kapow\desktop\alphajet's booking system\FrmBookingSystem.h(889) : error C2039: 'secondName' : is not a member of 'System::Windows::Forms::Label'
c:\windows\microsoft.net\framework\v2.0.50727\syst em.windows.forms.dll : see declaration of 'System::Windows::Forms::Label'
c:\documents and settings\kapow\desktop\alphajet's booking system\FrmBookingSystem.h(890) : error C2039: 'age' : is not a member of 'System::Windows::Forms::Label'
c:\windows\microsoft.net\framework\v2.0.50727\syst em.windows.forms.dll : see declaration of 'System::Windows::Forms::Label'
c:\documents and settings\kapow\desktop\alphajet's booking system\FrmBookingSystem.h(890) : error C2228: left of '.ToString' must have class/struct/union
c:\documents and settings\kapow\desktop\alphajet's booking system\FrmBookingSystem.h(891) : error C2039: 'seatNumber' : is not a member of 'System::Windows::Forms::Label'
c:\windows\microsoft.net\framework\v2.0.50727\syst em.windows.forms.dll : see declaration of 'System::Windows::Forms::Label'
c:\documents and settings\kapow\desktop\alphajet's booking system\FrmBookingSystem.h(891) : error C2228: left of '.ToString' must have class/struct/union
Form1.cpp
c:\documents and settings\kapow\desktop\alphajet's booking system\FrmBookingSystem.h(2 : error C2059: syntax error : '['
c:\documents and settings\kapow\desktop\alphajet's booking system\FrmBookingSystem.h(43) : error C3867: 'AlphaJetsBookingSystem::FrmBookingSystem::lblSeat 1_Click': function call missing argument list; use '&AlphaJetsBookingSystem::FrmBookingSystem::lblSea t1_Click' to create a pointer to member
c:\documents and settings\kapow\desktop\alphajet's booking system\FrmBookingSystem.h(43) : error C3350: 'System::EventHandler' : a delegate constructor expects 2 argument(s)
c:\documents and settings\kapow\desktop\alphajet's booking system\FrmBookingSystem.h(462) : error C3867: 'AlphaJetsBookingSystem::FrmBookingSystem::lblSeat 1_Click': function call missing argument list; use '&AlphaJetsBookingSystem::FrmBookingSystem::lblSea t1_Click' to create a pointer to member
c:\documents and settings\kapow\desktop\alphajet's booking system\FrmBookingSystem.h(462) : error C3350: 'System::EventHandler' : a delegate constructor expects 2 argument(s)
c:\documents and settings\kapow\desktop\alphajet's booking system\FrmBookingSystem.h(621) : error C3867: 'AlphaJetsBookingSystem::FrmBookingSystem::btnEnte r_Click': function call missing argument list; use '&AlphaJetsBookingSystem::FrmBookingSystem::btnEnt er_Click' to create a pointer to member
c:\documents and settings\kapow\desktop\alphajet's booking system\FrmBookingSystem.h(621) : error C3350: 'System::EventHandler' : a delegate constructor expects 2 argument(s)
c:\documents and settings\kapow\desktop\alphajet's booking system\FrmBookingSystem.h(880) : error C2660: 'AlphaJetsBookingSystem::FrmBookingSystem:asseng erType:assengerType' : function does not take 5 arguments
c:\documents and settings\kapow\desktop\alphajet's booking system\FrmBookingSystem.h(88 : error C2039: 'firstName' : is not a member of 'System::Windows::Forms::Label'
c:\windows\microsoft.net\framework\v2.0.50727\syst em.windows.forms.dll : see declaration of 'System::Windows::Forms::Label'
c:\documents and settings\kapow\desktop\alphajet's booking system\FrmBookingSystem.h(889) : error C2039: 'secondName' : is not a member of 'System::Windows::Forms::Label'
c:\windows\microsoft.net\framework\v2.0.50727\syst em.windows.forms.dll : see declaration of 'System::Windows::Forms::Label'
c:\documents and settings\kapow\desktop\alphajet's booking system\FrmBookingSystem.h(890) : error C2039: 'age' : is not a member of 'System::Windows::Forms::Label'
c:\windows\microsoft.net\framework\v2.0.50727\syst em.windows.forms.dll : see declaration of 'System::Windows::Forms::Label'
c:\documents and settings\kapow\desktop\alphajet's booking system\FrmBookingSystem.h(890) : error C2228: left of '.ToString' must have class/struct/union
c:\documents and settings\kapow\desktop\alphajet's booking system\FrmBookingSystem.h(891) : error C2039: 'seatNumber' : is not a member of 'System::Windows::Forms::Label'
c:\windows\microsoft.net\framework\v2.0.50727\syst em.windows.forms.dll : see declaration of 'System::Windows::Forms::Label'
c:\documents and settings\kapow\desktop\alphajet's booking system\FrmBookingSystem.h(891) : error C2228: left of '.ToString' must have class/struct/union
c:\documents and settings\kapow\desktop\alphajet's booking system\Form1.h(84) : error C3867: 'AlphaJetsBookingSystem::Form1::mnuNewFlight_Click ': function call missing argument list; use '&AlphaJetsBookingSystem::Form1::mnuNewFlight_Clic k' to create a pointer to member
c:\documents and settings\kapow\desktop\alphajet's booking system\Form1.h(84) : error C3350: 'System::EventHandler' : a delegate constructor expects 2 argument(s)
AssemblyInfo.cpp
Generating Code...
Build log was saved at "file://c:\Documents and Settings\Kapow\Desktop\AlphaJet's Booking System\Release\BuildLog.htm"
AlphaJet's Booking System - 30 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

Firstly pasting the errors you get when compiling helps us to help you.

CPP / C++ / C Code:
seats = PassengerType*[11]

What is happening on that line? seats is an array but you are trying to assign one element of the array PassengerType to the whole of seats I think.

Firstly you could do PassengerType[11] or *PassengerType or even *PassengerType[11] but not PassengerType*[11] I think. Then you seem to have a syntactical error, you have missed the semi-colon from the end of the line.

CPP / C++ / C Code:
this->seats[i]->Click += new System::EventHandler(this, lblSeat1_Click);

The compiler says that you are missing the arguments for the function lblSeat1_Click or if you want to create a pointer to a member function use &AlphaJetsBookingSystem::FrmBookingSystem::lblSeat 1_Click instead of AlphaJetsBookingSystem::FrmBookingSystem::lblSeat1 _Click

----------------------------------------------
firstName is a string but you are treating it as if it was a member of System::Windows::Forms::Label

I'm not sure if that helps you at all for now, if you try sorting those errors first you can post your updated code and we can try and go from there.
Last edited by LuciWiz : 06-Jun-2006 at 08:24. Reason: Please insert your C++ code between [c++] & [/c++] tags
  #4  
Old 07-Jun-2006, 17:02
gohan2091 gohan2091 is offline
New Member
 
Join Date: May 2006
Posts: 10
gohan2091 is on a distinguished road

Re: Can someone look through my code?


Thanks Johnny, you have been a big help. I have gotten further in my program now, I will post back here if I get further problems. Thanks all
 
 

Recent GIDBlogProblems with the Navy (Enlisted) by crystalattice

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Guidelines for posting requests for help - UPDATED! WaltP C Programming Language 1 11-Nov-2007 21:05
25-35% off on all shared & reseller packages FOR LIFE! my-e-space Web Hosting Advertisements & Offers 0 11-May-2006 21:00
Here it is again! 35% - 40% off For Life! my-e-space Web Hosting Advertisements & Offers 0 20-Apr-2006 14:48
functions seems not to exit from a certain code block jaro C Programming Language 3 21-Mar-2006 23:08
Problem with int mixed with char,... leitz C++ Forum 17 07-Dec-2004 20:56

Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The

All times are GMT -6. The time now is 13:16.


vBulletin, Copyright © 2000 - 2010, Jelsoft Enterprises Ltd.