473,395 Members | 1,846 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,395 software developers and data experts.

Adding a double value to ArrayList

San
Hi,
I'm using a Managed C++ project with MFC support. I have an ArrayList
pointer object alValue (ArrayList* alValue) to this object i want to add all
the elements present in Vector<double> vVector to it..

I'm using this line of code..

alValue->Add (new System::Double(vVector[i]))

and I'm getting the following compilation error..

error C2664: 'System::Collections::ArrayList::Add' : cannot convert
parameter 1 from 'double __gc *' to 'System::Object __gc *'

can somebody please tell me proper way of adding a double value to the
arraylist.

Thanks in advance..
San
Nov 17 '05 #1
1 2629
..NET containers can only store .NET objects (System::Object
descendants). It's not like the STL that can store anything. You have to
box your double value.

container->Add(__box(double_value));

Tom
San wrote:
Hi,
I'm using a Managed C++ project with MFC support. I have an ArrayList
pointer object alValue (ArrayList* alValue) to this object i want to add all
the elements present in Vector<double> vVector to it..

I'm using this line of code..

alValue->Add (new System::Double(vVector[i]))

and I'm getting the following compilation error..

error C2664: 'System::Collections::ArrayList::Add' : cannot convert
parameter 1 from 'double __gc *' to 'System::Object __gc *'

can somebody please tell me proper way of adding a double value to the
arraylist.

Thanks in advance..
San

Nov 17 '05 #2

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

Similar topics

2
by: Vishal Somaiya | last post by:
Hello I am trying read from a xml file, pull the values in a object and then add the object to an ArrayList. I am using a 'while' loop to move through each node in the xml file and pulling the...
0
by: Chris Millar | last post by:
I have a user control that i wish to extend to change the date when the user selects the numeric up down button. The code explains itself, hope someone can help. any ideas appreaciated.. ...
4
by: DotNetJunky | last post by:
I have built a control that runs an on-line help system. Depending on the category you selected via dropdownlist, it goes out and gets the child subcategories, and if there are any, adds a new...
3
by: NuB | last post by:
I need some help on this, I'm trying to add to an arrayList and its not working here is what i have public ArrayList carMake public ArrayList _CarMake { get { carMake; } set( carMake = value;...
2
by: Bob Hollness | last post by:
Hi group. I am a newbie to ASP.NET as you will see from some of the questions I may ask! I have a datagrid which I have populated from a database. It works great! I have added a column, via...
2
by: Tomek R. | last post by:
Hello ! I've got weird problem when adding new datagrid item. Here is the situation: my grid dgDeps is binded to DepartmentList arraylist, stored in Session between round-trips.. To add new...
6
by: Anders Würtz | last post by:
i have an assignment to iterate through a collection containing different types of numeric values (float, double, int, byte, short etc.) and to add 1 to all of them. I tried with array and...
14
by: Web learner | last post by:
In the following code, I want ArrayList object x to be of type double. How can I do that? --Thanks SqlConnection objConnection = new SqlConnection("server=(local)\\SQLEXPRESS;...
0
by: porky008 | last post by:
I need to add a search button to this and have no clue how to do it. Can some one please help me on this? import java.awt.*; import java.awt.event.*; import javax.swing.*; import...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.