lundi 20 avril 2015

Form does not contain a constructor that takes 1 arguments

I am attempting at filling a combobox with the groupname's and id in another form so I could edit them, however I am getting this UpdatePlayer does not contain constructor that takes 1 arguments and I have been stuck on this for over an hour now. It's getting ridiculous, I have tried {get; set;} and other things but failing. Bare in mind I am trying to learn object orientated programming and have only done it twice, so I am sorry if this is a stupid question.

public class GroupsPlayers
{
    public string GroupID;
    public string GroupName;
}

var smallGroups = new List<GroupsPlayers>();

while(rd.Read())
{
    var currentPlayer = new GroupsPlayers() {
        GroupID = rd["GroupID"],
        GroupName = rd["GroupName"]
    };

    smallGroups.Add(currentPlayer);
}

string msgBoxMsg = string.Format("There are {0} groups with fewer than 3 players. Do you want to add new players to the group?", smallGroups.Count);

MessageBoxResult userResponse = MessageBox.Show(msgBoxMsg, "Groups Manager", MessageBoxButtons.YesNo);

if(userResponse == DialogResult.Yes)
{
    UpdatePlayer frmPlayers = new UpdatePlayer(this, smallGroups);
}

Aucun commentaire:

Enregistrer un commentaire