Click here to Skip to main content
15,893,486 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: How to create Web Interface using MFC Program Pin
alex.barylski1-Nov-04 20:00
alex.barylski1-Nov-04 20:00 
AnswerRe: How to create Web Interface using MFC Program Pin
Michael P Butler1-Nov-04 23:54
Michael P Butler1-Nov-04 23:54 
GeneralGDIPlus cast *Image to Bitmap Pin
Nicholas Cardi1-Nov-04 17:12
Nicholas Cardi1-Nov-04 17:12 
Questionhow to get char (or) string from comport Pin
vc-programmer-1-Nov-04 16:43
vc-programmer-1-Nov-04 16:43 
AnswerRe: how to get char (or) string from comport Pin
jan larsen2-Nov-04 0:49
jan larsen2-Nov-04 0:49 
GeneralCreating an array of classes... Pin
viru_lent1-Nov-04 13:51
viru_lent1-Nov-04 13:51 
GeneralRe: Creating an array of classes... Pin
GDavy2-Nov-04 1:48
GDavy2-Nov-04 1:48 
GeneralRe: Creating an array of classes... Pin
viru_lent2-Nov-04 4:21
viru_lent2-Nov-04 4:21 
Thanks Davy. I think I've tried this... Now I'm getting a compile error. I'm using Visual Studio .net 2003 by the way.
/*
I'm trying to create my own class to store information about a person
in this example, an employee. This is just a test run to be able to
create a class, instantiate an aray of objects based on that class,
and update them as we need to input the record. This is just the first block of
a larger scope program.
*/
#using mscorlib.dll
using namespace System;

__gc class NameStorage //Starting the class definitions
{
public:


String* GetName() //GetName method to return a constructed name from inputed data
{
fullName = String::Copy(String::Concat(lastName,", ", firstName)); // Builds the full name string
return fullName; // using .Net String class methods
}

String* GetCompany()
{
return company; // Self explanatory
}

double GetSalary()
{
return salary; // Self explanatory
}

void SetFirstName(String* input)
{
firstName = String::Copy(input); // Following code inputs the data inputed
}

void SetLastName(String* input)
{
lastName = String::Copy(input);
}

void SetCompany(String* input)
{
company = String::Copy(input);
}

void SetSalary(double input)
{
salary = input;
}


private:
static String *firstName, *lastName, *company, *fullName = ""; // Variable inits.
static double salary = 0;


};

void main()
{
NameStorage *names[] = new NameStorage[3];

for(int i = 0; i < 3; i++) //Meat of the program, asks for input and assigns it to the objects.
{ // Error is coming in that the individual elements of the array are not
// being updated independently.
Console::Write("First Name: ");
names[i].SetFirstName(Console::ReadLine());
Console::Write("Last Name: ");
names[i].SetLastName(Console::ReadLine());
Console::Write("Salary: ");
names[i].SetSalary(Convert::ToDouble(Console::ReadLine()));
Console::WriteLine(names[0].GetName()); //Displays the contents of each array element for troubleshooting.
Console::WriteLine(Convert::ToDouble(names[0].GetSalary()));
Console::WriteLine(names[1].GetName());
Console::WriteLine(Convert::ToDouble(names[1].GetSalary()));
Console::WriteLine(names[2].GetName());
Console::WriteLine(Convert::ToDouble(names[2].GetSalary()));
}


return;
}

Now I'm getting the following errors:
StringSorter.cpp
StringSorter.cpp(62) : error C2691: 'NameStorage' : invalid type for __gc array element
StringSorter.cpp(62) : error C3149: 'NameStorage' : illegal use of managed type 'NameStorage'; did you forget a '*'?
StringSorter.cpp(62) : error C2691: 'NameStorage __gc *' : invalid type for __gc array element
StringSorter.cpp(68) : error C2228: left of '.SetFirstName' must have class/struct/union type
type is 'NameStorage __gc *'
did you intend to use '->' instead?

Last Error repeats for each reference back to the class.
General? about wav files Pin
tom_dx1-Nov-04 13:42
tom_dx1-Nov-04 13:42 
GeneralRe: ? about wav files Pin
KRowe1-Nov-04 16:56
KRowe1-Nov-04 16:56 
GeneralGetting the size of a block of code Pin
Xzyx987X1-Nov-04 12:34
Xzyx987X1-Nov-04 12:34 
GeneralRe: Getting the size of a block of code Pin
Andrew Walker1-Nov-04 15:21
Andrew Walker1-Nov-04 15:21 
GeneralRe: Getting the size of a block of code Pin
Xzyx987X1-Nov-04 21:44
Xzyx987X1-Nov-04 21:44 
GeneralRe: Getting the size of a block of code Pin
jan larsen2-Nov-04 0:57
jan larsen2-Nov-04 0:57 
GeneralRe: Getting the size of a block of code Pin
Maximilien2-Nov-04 2:47
Maximilien2-Nov-04 2:47 
GeneralRe: Getting the size of a block of code Pin
jan larsen2-Nov-04 3:29
jan larsen2-Nov-04 3:29 
GeneralRe: Getting the size of a block of code Pin
Anonymous2-Nov-04 7:49
Anonymous2-Nov-04 7:49 
GeneralThreading problem Pin
User 9148331-Nov-04 11:35
User 9148331-Nov-04 11:35 
GeneralRe: Threading problem Pin
Blake Miller2-Nov-04 7:59
Blake Miller2-Nov-04 7:59 
GeneralSplitter inside a Tab Window Pin
Ali Niaz1-Nov-04 11:17
Ali Niaz1-Nov-04 11:17 
GeneralRe: Splitter inside a Tab Window Pin
Selvam R2-Nov-04 3:01
professionalSelvam R2-Nov-04 3:01 
GeneralRe: Splitter inside a Tab Window Pin
Selvam R2-Nov-04 3:01
professionalSelvam R2-Nov-04 3:01 
GeneralRe: Splitter inside a Tab Window Pin
Ali Niaz2-Nov-04 4:17
Ali Niaz2-Nov-04 4:17 
QuestionWhere should I automatically launch a Modeless Dialog? Pin
nonothing1-Nov-04 9:51
nonothing1-Nov-04 9:51 
AnswerRe: Where should I automatically launch a Modeless Dialog? Pin
Christian Graus1-Nov-04 10:01
protectorChristian Graus1-Nov-04 10:01 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.