Can anybody tell me what is wrong ...

/*

I am trying to practice multidimensional array in a managed class using
dynamical allocation.

If I tried to compile the following codes, I would get the under mentioned

c2440 error message. It is only practice. You may notice that I am not using
"private"

or constructor here. Can anybody tell me what is wrong and how I can rewrite
that line right?

Thanks a lot.

*/

#include "stdafx.h"

#include <string.h>

#include <string>

#using <mscorlib.dll>

#include <tchar.h>

using namespace System;

using namespace std;

__gc class Month

{

public:

//private:

static const int weekOfMonth = 2;

static const int dayOfWeek = 3;

int pDaysOfMonth[,];

};


int _tmain()

{

Month *March;

March = new Month;

March->pDaysOfMonth = new int[6,7]; //<-----error C2440: '=' : cannot
convert

//from 'int *' to 'int __gc[,]'Can only

//convert a __gc array to or from Object * or Array *

March->pDaysOfMonth[0,0] = 3;

March->pDaysOfMonth[1,1] = 4;

return 0;

}

//Allen


0
5/18/2006 6:40:51 AM
vc.mfc 33608 articles. 0 followers. Follow

1 Replies
383 Views

Similar Articles

[PageSpeed] 59

Allen Maki wrote:

> /*
> 
> I am trying to practice multidimensional array in a managed class using
> dynamical allocation.
> 
> If I tried to compile the following codes, I would get the under mentioned
> 
> c2440 error message. It is only practice. You may notice that I am not using
> "private"
> 
> or constructor here. Can anybody tell me what is wrong and how I can rewrite
> that line right?
> 
> Thanks a lot.
> 
> */
> 
> #include "stdafx.h"
> 
> #include <string.h>
> 
> #include <string>
> 
> #using <mscorlib.dll>
> 
> #include <tchar.h>
> 
> using namespace System;
> 
> using namespace std;
> 
> __gc class Month
> 
> {
> 
> public:
> 
> //private:
> 
> static const int weekOfMonth = 2;
> 
> static const int dayOfWeek = 3;
> 
> int pDaysOfMonth[,];
> 
> };
> 
> 
> int _tmain()
> 
> {
> 
> Month *March;
> 
> March = new Month;
> 
> March->pDaysOfMonth = new int[6,7]; //<-----error C2440: '=' : cannot
> convert
> 
> //from 'int *' to 'int __gc[,]'Can only
> 
> //convert a __gc array to or from Object * or Array *
> 
> March->pDaysOfMonth[0,0] = 3;
> 
> March->pDaysOfMonth[1,1] = 4;
> 
> return 0;
> 
> }
> 
> //Allen
> 
> 

Allen:

You have asked this question using two different subjects (both 
uninformative) in three different groups. That is six separate postings.

This question has nothing to do with MFC, so there is no purpose to 
posting it here. The best group for questions on managed C++ is

microsoft.public.dotnet.languages.vc

If you feel you must post to more than one group, use cross-posting, not 
multi-posting.

David Wilkinson
0
no-reply8010 (1791)
5/18/2006 11:25:47 AM
Reply:

Similar Artilces:

How can I copy Double-Click event behavior to multiple shapes in Visio
Hi, How can I copy the double-click event behavior to many shapes in my Visio drawing? I'd rather not have to visit the ShapeSheet for each shape and paste the formula into the EventDblClick field, since I have a lot of shapes to do this to. Is there a way to do that? Thanks, Joe Either write some VBA code to set the Dbl-Click property or try Visio's ShapeStudio that comes with the SDK kit. John... Visio MVP Need stencils or ideas? http://www.mvps.org/visio/3rdparty.htm Need VBA examples? http://www.mvps.org/visio/VBA.htm Common Visio Questions http://www.mvps.org/visio/com...

How can I extend maximum number of records when opening sylk file?
When opening a .slk file in Excel 2002 you can only see the first 32,767 records. I have a file that is larger than this , and therefore I cannot see all of the data. I know that you can extend the maximum number of records when opening a text file - I just need to know how to do it. Can anybody help me please? Opening a text file and a SYLK file are two different operations "under the hood". If 32,767 is the limit, there's probably not much you can do about it. Do you have control over the workbook from which the SLK file was produced? If so, can you split it into two ...

Is there a command line string I can use to send email?
If I can send email from a command prompt I can figure out a way to do a mass email to a list of people volunteering for something where I work - the list changes daily. Sandra <ab@mdahospital.com> wrote: > If I can send email from a command prompt I can figure out a way to > do a mass email to a list of people volunteering for something where > I work - the list changes daily. Check the tools here: http://www.slipstick.com/addins/mail.htm#massmail -- Brian Tillman ...

Can I exclude the criteria Value from the query results?
I am using the [Dupe_Joiner_Title_ID] to match a list of records from a duplicates table against an ID form field, but want to exclude the actual value that the query uses as the criteria from being seen in the continous form that is linked to the query, but shows all other matching records for the form's current record. This is the criteria code: [Forms]![frm_Runs]![frm_Street_Joiner_Main].[Form]![frm_Street_Joiner_Sub].[Form]![Joiner_Title_ID] that is in the 'Dupe_Joiner_Title_ID: Joiner_Title_ID' column. This is my SQL: SELECT Tbl_Street_Joiner_Dupes.Address, Tbl_Stree...

FP Can't Close Table Message
Does anybody know what causes the FP Can't Close Table message and how to prevent it? Additionally, what does "FP" mean? Thanks -- Charles Allen, MVP FP means "Forms Processor." The subsystem within Dynamics that processes the controls, tables and business logic associated with each form within Dynamics. The reasons for FP's in-ability to close a table can vary widely. If you have a reproducable problem (i.e. it occurs regularly) you should discuss the problem with Dynamics support. "Charles Allen" wrote: > Does anybody know what causes the...

How can I view all of my tabs in one screen? Can I layer them?
Afraid not. You can make the display wider, but invariably at some point it is not wide enough. -- HTH Bob Phillips "Angelica" <Angelica@discussions.microsoft.com> wrote in message news:442BF163-9C71-41CB-B2C5-A5952CBCCE4A@microsoft.com... > One trick I use..........I have a workbook with 36 Sheets, I hide them all and create a new one (not hidden) named MainMenu and make an attractive list of all of them and create macros to each just by clicking on the name..............then on each sheet, I put a "Return to MainMenu" button which hides the sheet ag...

HOW CAN I COMPILE 2 SHEETS?
HOW CAN I COMPILE 2 SHEETS? n tell me what is the formula of subtraction in it? how can we repeat the same row in all pages of a sheet (in printing) without copying & pasting... ? thanx.......................... Homework? -- Don Guillett Microsoft MVP Excel SalesAid Software dguillett1@austin.rr.com "Sweeney *" <Sweeney *@discussions.microsoft.com> wrote in message news:AD03E931-51F8-49B8-9184-CEC86D586E58@microsoft.com... > HOW CAN I COMPILE 2 SHEETS? n tell me what is the formula of subtraction > in > it? > > how can we repeat the same ro...

Help! How can I send email to ALL email addresses in a category?
Here is the procedure I follow...(I use Outlook 2003) 1. Create multiple users. 2. Each user has multiple email addresses (i.e. Email1, Email2, etc.) 3. Each user belongs to certain categories. I want to send out a single message to all users in a particular group. Like for example this... 1. Change the view to Categories (by clicking View/Arrange By/Categories. 2. Highlight the CATEGORY Name. 3. Click on the "New Message to Contact" button (the icon looks like a little envelope and a piece of paper - keep in mind that I'm not referring to the "New Message" butto...

Can't backup outlook file
Hi, After I burn the outlook.pst into the cdrom, I tried to test it, but it doesn't work. I got the following error message: The file is not a personal folder file. Can I ask why? I have changed to not read only, but still not working. why? Thanks Adrian Adrian schrieb am 25.05.2005 14:51: Hello Adrian, > After I burn the outlook.pst into the cdrom, I tried to test it, but it > doesn't work. I got the following error message: > The file is not a personal folder file. > Can I ask why? I have changed to not read only, but still not working. why? When you have copie...

is there any sort of spam filter i can use on ms outlook?
is there any sort of spam filter i can use on ms outlook?? jp <jp> wrote: > is there any sort of spam filter i can use on ms outlook?? http://spambayes.sourceforge.net/ is one. There are others. -- Brian Tillman ...

Can you reformat order of items in Pivot Tables after refresh?
When I set up pivot tables for time reporting entries at work, there are often new projects that come in weekly, and every time that I refresh the report, the new items do not show up in alphabetical order in the drop down list (in the Page Field). Do any of you know if it's possible to reformat the order of these items without having to rebuild the report? I'm dealing with about 200 projects, and it becomes very difficult to sort when new projects are added at the bottom while the rest are listed alphabetically. I'd GREATLY appreciate any ideas! : ) Drag the page fi...

can i reinstall the software without having to buy another key?
My computer crashed after getting hit with a nasty virus and i lost everything. Can i reinstall my microsoft office home and student 2007 without having to buy a new license? I already used all 3 licenses in the pkg. on my family computers. If you have the installation disk and its currently installed on 2 or less working PC's (The license is for 3 working installations) If as you say its allready running on 3 PC's then you would need to purchase the Office version you require (ie a complete pkge) "snackmonkey" <snackmonkey@discussions.microsoft.com> w...

MFC CRecordset::m_strFilter: Can I use SQL "LIKE" [%] in here?
Hi, Can I use SQL LIKE condition in the m_strFilter of my RecordSet? I am setting the filter datamember as <code> rsSampleRS.m_strFilter = "Number = '123'"; </code> But what I intend is to have a SQL "LIKE" in the statement as; All records from the table in where "123" is part of the value in the Number column. Any pointers/ help will be appreciated. Thanks for your time. Cheerz, Denzil If you could ... I don't think you'd want to. From what I remember, the filter only gets applied after the query is run. So if your table h...

I get a file in use message telling me that the file is locked ?
This is a one user computer and the file is not being used. The box containing the error message says "FILE IN USE". If I reboot I can get into the file once only before having the same error message. I have tried saving the file under a different file name but that file acts the same. I have checked permisions and that is not the problem either .....HELP! ...

Outlook 2003
If I click on the To or CC box when composing a message, a 'Select Names' dialog comes up with a list of contacts. However this list is not coming from my Outlook contacts. It is an older, out of date list of contacts from before my upgrade from Office XP to 2003. The option in Internet properties is to use Microsoft Office Outlook for the contact list. In the select names dialog, the combo box in the top right 'show names from the' defaults to 'contacts', this lists the wrong contacts; the option 'outlook address book' lists no contacts at all. If I type a n...

Can these look ups be done using Worksheets functions
I have two UDF's that solve two specific problems for me. Both works great. Now I just wonder if I could acchieve the thing, using only Worksheet functions as some of the people that would like to use my solution are not allowed to use macros or install add-ins. And if it can be done, then how? Problem 1. Data: A B John 10 Bill 10 George 14 John 12 Neil 12 George 12 John 20 I need to be able to look up any instance of a name in column 1, and return ...

MsPub 2003 missing my fonts, PDF has wrong margins... what's going on!
I went to my local Office Depot to get my posters printed (color 11 by 17) as usual.... They now have MS Publisher 2003, which will load my Pub 2000 files, but they don't have my font! Is there some way I can embed the font within Publisher so they can print my posters? Luckily, I took the files also in PDF format and had them printed that way, but once again, they had upgraded to the new Adobe tool, which apparantly now does not allow adjustment of the poster to center it on the page, or resize to fit.. and so I lose my right hand margin. I'm either going to have to get mysel...

Can't delete email messages
After i received about 300 worm emails, I can not delete any of the emails i have received. When I hit the delete key, I get the following error message " The message interface has returned an unknown error. If problem persists, restart outlook". I have Norton Anti Virus, and I have verified that my machine is free of Virus. Even though I have restarted Outlook many times, the problem persists. Any suggestions. thanks for the help Bob Yeary Bob@Yeary.net Oh woe is me. Regardless if you using an ISP or exchange server. Create a new pst file. Move the message you want ...

Simple but I can't get it to work? PLEASE help!!
I don't know why my code isn't working. I tried implementing some examples I found on here after doing a search, but I received an Object error. I have spent the past 2 hours trying to figure this out, so any help would be appreciated. I am quite a newbie I suppose...All I'm trying to do is as follows: 1)I need to find today's date in the range C3-BO3. 2)Once I found the cell with today's date, I need to set the cell below it as the variable HMLoc . It sounds simple but I tried using the Find method but got nowhere. Please help! You will make my day! Is this a workshe...

Can't open Outlook 04-28-10
When trying to open Outlook, I get the following message: Cannot start microsoft office outlook. Cannot open the outlook window. Other Office products work fine. "Harley13" <Harley13@discussions.microsoft.com> wrote in message news:0C7142B7-B90A-425C-A9F9-3B8127BA1B56@microsoft.com... > When trying to open Outlook, I get the following message: Cannot start > microsoft office outlook. Cannot open the outlook window. Other Office > products work fine. > > A quick search either here or in Google would have given you the solution to this very ...

Delegate can print calendar
Can a Delegate print a my Calendar, if so where do I make the setting to allow it to happen. ...

Can't install update KB9532957...see below message for particulars
I STILL can't install: Microsoft.NET Framework 1.1 Service Pack 1 Security Update for Windows XP (etc) and Windows Server 2008 R2 ( KB953297 ) More and more system blocks and failures are occuring... PLEASE HELP !!! Many thanks in advance! See the "How to obtain help" section of http://support.microsoft.com/kb/953297 For home users, no-charge support is available by calling 1-866-PCSAFETY (and/or 1-866-234-6020 and/or 1-800-936-5700) in the United States and in Canada or by contacting your local Microsoft subsidiary. There is no-charge for support c...

Can't Scroll Text in a Single-line CEdit
Hello all, I have a problem with single-line CEdit controls. I have one where I put text into it, using SetWindowText(). And then I select part of that text, using SetSel(). But I need the caret to end up at the beginning of the selection, not the end. The user needs to see the start of the selection. How do I put the caret at the beginning of the selection and scroll the text back so you can see the caret? I tried something like this (which doesn't work): int iSelStart = GetIndexOfSelectionStart( pMyCEdit ); int iSelEnd = GetIndexOfLastChar( pMyCEdit ); pMyCEdit->SendMessage(EM...

Can't opening crm in braowser after installing.
Hi, if have installed crm on a server 2003 with sql2005,exchnage2003. The user i installed have domainadministrator access. After installation i can't open crm in the internet explorer. A popup shows which says: activate user dataset. What should I do now. Everything is correct installed, but after the installation I can't go into the crm...???? What should I do now? I hope someone have a solution for me. regards, Michael Hi Karsten, I'm not familiar with the "activate user dataset" message, but I'd like to ask more about your installation - did you point yo...

How can I change the current default size for formatting a picture
When I paste a screen print the format size automatically defaults to 4.5" height. How can I change this to default to another size. Ordinarily, Word will restrain the size of an inline object to margin width. If the screen shot is taken at a 3x4 ratio, and your margin width is the default 6", then the height is going to be 4.5". If you paste into a landscape page, it will be larger. -- Suzanne S. Barnhill Microsoft MVP (Word) Words into Type Fairhope, Alabama USA http://word.mvps.org "Curious George" <Curious George@discussions.microsoft.com&...