\r\n\r\n
Go Back  Xtreme .NET Talk > .NET > Syntax Specific > Visual C# .NET > Problem with userdefined Arrays


\r\n \r\n \r\n \r\n
 
 
Thread Tools Display Modes
\r\n \r\n
\r\n
\r\n \r\n Hi,
\n
\ni have a big Problem with this code:
\n
\n
\r\n
Code:
\r\n
class Tile
        {
            public int x;
            public int y;
        }

        private void Form1_Load(object sender, System.EventArgs e)
        {
            int Counter1, Counter2, iC;

            iC = 10;           

            for (Counter1 = 0; Counter1 != iC; Counter1++)
            {
                for (Counter2 = 0; Counter2 != iC; Counter2++)
                {

                    Tile[,] CTile = new Tile[iC,iC];
               
                    CTile[Counter1, Counter2].x = 5;
                }
           
            }
        }
\r\n

\ni need a 2 dimensional array, but this code throws out an error. Could someone help me? Or has a better solution? If i define the Array as int it\'s no Problem, but if i do with the Tile class, it won\'t run. Thx. for help! \r\n
\r\n
\r\n \r\n
\r\n \r\n\r\n \r\n \r\n\r\n \r\n\r\n \r\n\r\n \r\n \r\n
\r\n
\r\n \r\n \r\n Last edited by PlausiblyDamp; 02-19-2007 at 06:23 AM.\r\n \r\n \r\n \r\n
\r\n \r\n \r\n\r\n
\r\n \r\n \r\n \r\n \r\n Reply With Quote\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n
\r\n\r\n \r\n\r\n
\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n \r\n \r\n \r\n \r\n\r\n\r\n\r\n\r\n'; pd[370297] = '\r\n\r\n \r\n\r\n
\r\n
\r\n
\r\n\r\n
\r\n \r\n\r\n\r\n\r\n\r\n\r\n \r\n\r\n\r\n\r\n \r\n
\r\n
\r\n  \r\n #2  \r\n \r\n \r\n \r\n \r\n \r\n
\r\n\r\n
\r\n \r\n Old\r\n \r\n 06-23-2003, 05:25 AM\r\n \r\n \r\n \r\n
\r\n
\r\n \r\n \r\n \r\n \r\n \r\n
\r\n\r\n
\r\n \r\n FreewareFire\r\n FreewareFire is offline\r\n\r\n\r\n
Prev Previous Post   Next Post Next
  #1  
Old 06-23-2003, 02:02 AM
FreewareFire FreewareFire is offline
Freshman

Preferred language:
C#
 
Join Date: May 2003
Posts: 28
FreewareFire is on a distinguished road
Unhappy Problem with userdefined Arrays

Hi,

i have a big Problem with this code:

Code:
class Tile
        {
            public int x;
            public int y;
        }

        private void Form1_Load(object sender, System.EventArgs e)
        {
            int Counter1, Counter2, iC;

            iC = 10;           

            for (Counter1 = 0; Counter1 != iC; Counter1++)
            {
                for (Counter2 = 0; Counter2 != iC; Counter2++)
                {

                    Tile[,] CTile = new Tile[iC,iC];
               
                    CTile[Counter1, Counter2].x = 5;
                }
           
            }
        }

i need a 2 dimensional array, but this code throws out an error. Could someone help me? Or has a better solution? If i define the Array as int it's no Problem, but if i do with the Tile class, it won't run. Thx. for help!

Last edited by PlausiblyDamp; 02-19-2007 at 06:23 AM.
Reply With Quote
 

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Arrays Arrays Arrays (simple question) rifter1818 Visual C++ .NET 1 05-18-2004 10:59 PM
Some arrays problem Acid Cool General 2 12-26-2003 03:41 PM
Problem with character/pointer arrays netsniper General 5 12-10-2003 09:52 PM
Problem with structures in arrays Jay1b General 4 12-04-2003 04:17 AM
Structure with arrays - Problem writing to arrays!!! Please help! skyyakal General 3 10-29-2003 07:45 AM

Advertisement:

Powered by liquidweb