I'm trying to add a button to the form using code and iv'e looked it up on the internet but nothing works.
public void addSnake()
{
Button btn = new Button();
btn.Location = new Point(360, 390);
btn.Size = new Size(10, 10);
btn.Text = "";
btn.Name = num + "";
btn.Tag = this.oneD;
btn.IsAccessible = false;
Controls.Add(btn);
}
public Point getPoint()
{
Button btn = (Button)Controls.Find(num + "");
return this.pos; //temporary
}
it says "The name 'Controls' does not exist in the current context". (for both functions)
Note: the functions addSnake and getPoint are inside a Class I made
Full code here: deleted
System.Windows.Forms.Form? Else there is no such property if you have not declared one by yourself.