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");
> 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.
[quoted text clipped - 13 lines]
> lstOutput->Items->Add(buffer);
> lstOutput->Items->Add(S"and lox");
It compiles with:
lstOutput->Items->Add(new String("bagel"));
lstOutput->Items->Add(new String ("and lox"));
greets, Sebastian Dau
Howard Kaikow - 30 May 2005 20:12 GMT
> > 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.
[quoted text clipped - 19 lines]
>
> lstOutput->Items->Add(new String ("and lox"));
Thanx.
So I can use
char *buffer;
buffer = "Bagels";
lstOutput->Items->Add(new String(buffer));
lstOutput->Items->Add(S"and lox");

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