@wio
``` using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace WindowsFormsApplication1 { class Tile { private int m_x; private int m_y; public int x { get { return m_x; } set { m_x = value; } } public void New(int xc, int yc) { m_x = xc; m_y = yc; } } } ```
Try ``` public Tile(int xc, int yc) { m_x = xc; m_y = yc; } ```
ok yeah that worked too
is it necessary to do that instead of New though?
Ummm, wouldn't New be a method, rather than a constructor?
I'm used to the constructors in vb.net all being called New(), but idk yo
Also, how do I declare a tile object outside of the tile class? Is there a using statement I need to do or something?
Oh, well VisualBasic is weird.
Declare a tile object outside of the tile class? Don't you just need to import it?
What is the code that isn't working?
`tile tile = new tile(i1, i);` trying to do `using windowsapplication1.tile` but VS doesn't like that.
Did you make sure to capitalize correctly?
ye. ``` Severity Code Description Project File Line Suppression State Error CS0138 A 'using namespace' directive can only be applied to namespaces; 'Tile' is a type not a namespace. Consider a 'using static' directive instead WindowsFormsApplication1 ```
WAIT NEVERMIND I GOT IT it was capitalization in the line declaring the object capitalization is going to be the death of me
Why would you need a tile object anyway?
The board is made up of tile objects? What data are they keeping track of?
ye the board is made up of tile objects, which are only in there to keep track of piece locations p much
If you make an array of arrays to store pieces, the indices will indicate the tile positions.
``` using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; namespace WindowsFormsApplication1 { public partial class Tile : PictureBox { private int m_x; private int m_y; public int x { get { return m_x; } set { m_x = value; } } public int y { get { return m_y; } set { m_y = value; } } public Tile(int xc, int yc) { base.@New; m_x = xc; m_y = yc; } } } ```
The error is at base.@New;, because PictureBox's constructor isn't New, apparently. No idea what it is.
``` public Tile(int xc, int yc) ``` Change to ``` public Tile(int xc, int yc) : base() ```
Where do you get this `.@New` stuff?
I don't think you can really rely much on VisualBasic for this stuff.
I'm using a code converter to try to help understand the syntax
converted mybase.new because that's how vb calls base constructors
thanks again tho :*
Not sure if you even need `: base()`, it might be default behavior
still couldn't hurt to add it, I reckon
Join our real-time social learning platform and learn together with your friends!