Here's the problem, on form load I have a method which checks if there are any groups with players with equal to or less than 3. If there are it shows a messagebox with the groupnames. I am trying to display the count of the groupnames instead so example, There are 3 groups with less than 3 players. Do you want add new players to the group? If the user clicks Yes, another form called UpdatePlayer should open with comobobox filled with the 3 groups that need updating. if no then continue to the main form. I have this:
SqlConnection con = new SqlConnection(connection);
SqlCommand cmd = new SqlCommand ("SELECT GroupID, GroupName, TeamAmount FROM GroupsPlayers WHERE TeamAmount <= 5", con);
con.Open();
SqlDataReader rd = cmd.ExecuteReader();
StringBuilder groupsUpdate= new StringBuilder();
while(rd.Read())
{
groupUpdate.Append(rd["GroupName"].ToString()+Environment.NewLine);
}
con.Close();
if (MessageBox.Show(string.Format("There are {0} groups with less than 3 players. Do you want add new players to the group?", groupUpdate.Count), "Groups Manager", MessageBoxButtons.YesNo) == DialogResult.Yes)
{
UpdatePlayer frmPlayers = new UpdatePlayer(this);
//this opens the new form
//how do i pass the groupnames with their id to combobox in frmPlayers so i could then populate textboxs to update their players?
}
else
{
}
All the groupUpdate.Count
isn't working. String format has invalid arguments?
Aucun commentaire:
Enregistrer un commentaire