473,322 Members | 1,671 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

My first C++ Form

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");
Nov 17 '05 #1
2 1741

"Howard Kaikow" <ka****@standards.com> schrieb im Newsbeitrag
news:OD**************@TK2MSFTNGP14.phx.gbl...
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");


It compiles with:

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

lstOutput->Items->Add(new String ("and lox"));
greets, Sebastian Dau
Nov 17 '05 #2
"Sebastian Dau" <se***********@web.de> wrote in message
news:42**********************@news.freenet.de...

"Howard Kaikow" <ka****@standards.com> schrieb im Newsbeitrag
news:OD**************@TK2MSFTNGP14.phx.gbl...
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");


It compiles with:

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

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");
--
http://www.standards.com/; See Howard Kaikow's web site.
Nov 17 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Rene | last post by:
I'm trying to learn how to use python for cgi scripts... I created a form that submits some info that I put in a cookie. Then the script calls itself and reads the cookie, and displays a...
2
by: bart plessers | last post by:
Hello, I have a form with some checkboxes, i.e. The default value of this checkbox is determined in a global file (config.asp), that is included in first line of the form, i.e. ShowFilenames...
1
by: Erik Jensen | last post by:
I am interested in calling Application.Run() without passing a first form as the argument to the Run method. Reason being is that i would like to instantiate some helper or foundation classes...
3
by: Jason A. Thompson | last post by:
Dear Access Gurus, I have a database which I hoped to use to administer questionnaires, or rather that someone who knows nothing about Access could use to administer them. Each q'aire item is on...
5
by: tdmailbox | last post by:
I have a form with a child form. In the child form there is a list of names that can grow quite large. On the parent form I want to display the first name from the child form. I set up a test...
6
by: DrifterKona | last post by:
I have a form with 4 pages. I'm not sure of the correct name, but I will refer to the tabs at the top of the form that list the names of the four pages as the "page tabs". When the form opens,...
3
by: Torben Laursen | last post by:
I have a COM shared add-in written in C# that I use in Excel. One of the thinks that the user can do is to open some winforms. The problem that I have is that the first time the user opens a...
22
AccessIdiot
by: AccessIdiot | last post by:
Hello all, I have a form (frm_Entrainment) with a button that opens a 2nd form (frm_Specimen_Entrainment). The 2nd form shares an ID field with the first form (Entrainment_ID - its like opening...
3
by: brucedodds | last post by:
My application has a form based on a parent table with a subform based on a child table. The relationship is Cascade Delete. The first record displayed when the form opens has five child records....
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.