Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / Managed C++ / May 2005

Tip: Looking for answers? Try searching our database.

My first C++ Form

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Howard Kaikow - 30 May 2005 17:46 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.

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");
Sebastian Dau - 30 May 2005 19:41 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 - 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.


Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.