private void btn_startVotingSession_Click(object sender, EventArgs e) { if ((lst_candidates.Items.Count != 0) && (lst_voters.Items.Count != 0) && (txt_password.Text.Length != 0) && (txt_time.Text.Length != 0)) { var votemain = new frm_castVote();// creating new instance votemain.password = txt_password.Text; votemain.time = Convert.ToInt32(txt_time.Text); votemain.voters = new Dictionary<string, bool>(); foreach (string items in lst_voters.Items) { votemain.voters.Add(items, false); } votemain.results = new Dictionary<string, int>(); foreach (string items in lst_candidates.Items) { votemain.results.Add(items, 0); } votemain.Show(); this.Hide(); } }
private void btn_startVotingSession_Click(object sender, EventArgs e) { if ((lst_candidates.Items.Count != 0) && (lst_voters.Items.Count != 0) && (txt_password.Text.Length != 0) && (txt_time.Text.Length != 0)) { var votemain = new frm_castVote();// creating new instance votemain.password = txt_password.Text; votemain.time = Convert.ToInt32(txt_time.Text); votemain.voters = new Dictionary <string, bool>(); foreach (string items in lst_voters.Items) { votemain.voters.Add(items, false); } votemain.results = new Dictionary <string, int>(); foreach (string items in lst_candidates.Items) { votemain.results.Add(items, 0); } votemain.Show(); this.Hide(); } }