Arrays in Visual Studio.Net 2003
Hello everyone
I am a beginner C++ programmer and I have a difficult problem that came up while using Visual Studio 2003. I wrote a simple blackjack program in console mode with Visual Studio and I finished it with no problem. Being that I wish to make my program graphical, I borrowed the playing cards from the cards.dll that microsoft uses for windows so that I may learn how to write such a program. It became apparent after some investigation to use a windows forms application to port my console program over. It seems that the imagelist object would allow me to draw the bitmaps of the cards to the form with no problem. I wrote a Card class that displays itself in graphics mode with no problem and I was very elated until I started having problems with my code. Using the IDE I generated a windows forms application project and added my code to it. I was having problems when I tried to declare an array that I was using to represent the card deck. In my code I wrote:
Card deck[52];
The compiler kept telling me that only _gc or _nogc arrays are allowed, but whenever I used the syntax of the _nogc keyword I got errors. Finnally, I declared my array dynamically, but then I found that my array consisted of only one element. In debugger mode I can only see one array element, is that because is declared dynamically and I only have access to the address of the first element? Please enlighten me!