0

I'm currently trying to make a form that sends 2 class, then receives the data, uses them but want to shoot them back to the original form. Any idea on how I could?

This is when i call my second form:

        var tmp = new Pjeu(P1,P2);
        tmp.Show();

P are Players. Here's the class: //---

public class Player
{
    public string Name;
    public int pts1;
    public int pts2;
    public int num;
};

And I receive the data like this:

label3.Text = P1.Name;
label5.Text=P2.Name;

I want to use P1.pts or shoot back a number to it. Is it possible the way I do?

Akhter Al Amin
  • 852
  • 1
  • 11
  • 25
Zellarius
  • 3
  • 1
  • Check out my answer here: http://stackoverflow.com/questions/41007088/change-label-text-via-listview-itemactivate/41008137?noredirect=1#comment69225672_41008137 – Landon Conway Dec 11 '16 at 06:18
  • Check out my answer here: http://stackoverflow.com/questions/41007088/change-label-text-via-listview-itemactivate/41008137?noredirect=1#comment69225672_41008137 – Landon Conway Dec 11 '16 at 06:19

1 Answers1

0

You can use multi way:

public class Player
{
    public void Pa(string p1,string p2)
    {
        p1 = Name;
        p2 = Name;
    }
    public string pass1(int ps1)
    {
        return ps1.ToString();
    }
    public string pass2(int ps2)
    {
        return ps2.ToString();
    }
    public string Name { get; set; }
    public int pts1 { get; set; }
    public int pts2 { get; set; }
    public int num { get; set; }
}

and call:

        Player p = new Player();
        p.Pa(Label1.Text, Label2.Text);
        Label1.Text = p.pts1.ToString();
        Label2.Text = p.pts2.ToString();