all groups > visual c > may 2005 >
You're in the

visual c

group:

My first C++ Form


My first C++ Form Howard Kaikow
5/30/2005 12:00:00 AM
visual c:
I'm trying to use a Form in C++ for the first time.
Alas, my only C++ .NET book is for 2002, so it does not cover Forms.

In the snippet below, where lstOutput is a Listbox control, I get the error:

i:\C++\C++Code\UseForm\Form1.h(121): error C2664:
'System::Windows::Forms::ListBox::ObjectCollection::Add' : cannot convert
parameter 1 from 'char *' to 'System::Object __gc *'

What do I have to do to correct the problem?

char *buffer;

buffer = "Bagels";
lstOutput->Items->Add(buffer);
lstOutput->Items->Add(S"and lox");

Re: My first C++ Form Howard Kaikow
5/30/2005 3:12:38 PM
[quoted text, click to view]


Thanx.

So I can use

char *buffer;
buffer = "Bagels";
lstOutput->Items->Add(new String(buffer));
lstOutput->Items->Add(S"and lox");


--
http://www.standards.com/; See Howard Kaikow's web site.

Re: My first C++ Form Sebastian Dau
5/30/2005 8:41:23 PM

"Howard Kaikow" <kaikow@standards.com> schrieb im Newsbeitrag
news:ODYm0bTZFHA.1088@TK2MSFTNGP14.phx.gbl...
[quoted text, click to view]

It compiles with:

lstOutput->Items->Add(new String("bagel"));

lstOutput->Items->Add(new String ("and lox"));


greets, Sebastian Dau

AddThis Social Bookmark Button