private void button2_Click(object sender, EventArgs e) { if (boogles.ContainsKey(textBox2.Text) == true) { if (rs.ContainsKey(textBox2.Text) == false) { rs.Add(textBox2.Text, null); point++; label2.Text = point.ToString(); if (rs.Count == boogles.Count) { MessageBox.Show("You win! Point = " + point); rs.Clear(); } } else { MessageBox.Show("You have found this word already!"); } } else { MessageBox.Show("This word doesn't exist"); } }
private void button1_Click(object sender, EventArgs e) { try { if (Int32.Parse(textBox1.Text) < 2 || Int32.Parse(textBox1.Text) >= 10) { MessageBox.Show("You have to enter the number from 2-9"); textBox1.Text = "4"; } genBroad(Int32.Parse(textBox1.Text)); } catch (FormatException) { textBox1.Clear(); textBox1.Text = "4"; } button2.Visible = true; rs.Clear(); listView1.Items.Clear(); for (int i = 0; i < bBoard.dimensions(); i++) { for (int j = 0; j < bBoard.dimensions(); j++) { if (labels is Object) { labels[i, j].Visible = false; } } } bBoard = new Board(genBroad(Int32.Parse(textBox1.Text))); // creating boggle board labels = new Label[Int32.Parse(textBox1.Text), Int32.Parse(textBox1.Text)]; String s = ""; for (int i = 0; i < bBoard.dimensions(); i++) { for (int j = 0; j < bBoard.dimensions(); j++) { Label l = new Label(); l.Location = new Point(590 + i * 20, 50 + j * 20); l.Text = bBoard.getItem(i, j); l.Size = new Size(15, 15); l.BorderStyle = BorderStyle.FixedSingle; s += l.Text; labels[i, j] = l; this.Controls.Add(l); } } boogles.Clear(); genALlWord(); }