farmor

farmor

  • NA
  • 1
  • 0

How to change object in main form from class in c#?

Jun 6 2006 8:28 PM
Hello all.
I am learning a little c# and done most java console apps before so I will try to do a chess program in c# ,for fun it don't have to be strong, but I have a problem I don't know how to get access to the form from a class I understand I need a referens but don't know how to get one.
Here is my code:

using System;
using System.Collections.Generic;
using System.Text;

namespace Schack
{
class Bord
{
private Pjas[,] pjaser;

public Bord()
{
pjaser = new Pjas[8,8];
int[] start = new int[2];
for (int i = 0; i <= 7; i++)
{
start[0] = 1;
start[1] = i;
pjaser[1,i]=new Bonde(start,0);
}
}

public void rita()
{
??????????? The Line under is the problem.
Form1.label1.Text ="Hello"; //////Dont work (It has no referens how do I create one?)
for (int i = 0; i <= 7; i++)
for (int k = 0; k <= 7; k++)
{
if (pjaser[i, k] != null) pjaser[i, k].rita();
}
}
}
}

Answers (1)