private void Form1_Load(object sender, EventArgs e) { //checkedComboBox1.Items.Add(12); //checkedComboBox1.Items.Add(18); //checkedComboBox1.Items.Add(30); //checkedComboBox1.Items.Add(40); //checkedComboBox1.Items.Add(50); //checkedComboBox1.Items.Add(60); //checkedComboBox1.Items.Add(70); //checkedComboBox1.Items.Add(90); //checkedComboBox1.Items.Add("M1"); int i5 = 1; foreach (DataGridViewColumn obj in dataGridView3.Columns) { i5++; DataGridViewColumn col = new DataGridViewColumn(); col.Width = obj.Width; col.CellTemplate = new DataGridViewTextBoxCell(); col.HeaderText = obj.HeaderText; col.Name = "col" + i5.ToString(); dataGridView2.Columns.Add(col); } category_halder item = new category_halder(); item.a = textBox2; item.b = comboBox3; item.c = comboBox4; item.f = comboBox1; categories.Add(item); m_sqlCmd = new SQLiteCommand(); dbFileName = "sample.sqlite"; //lbStatusText.Text = "Disconnected"; if (!File.Exists(dbFileName)) { SQLiteConnection.CreateFile(dbFileName); } try { m_dbConn = new SQLiteConnection("Data Source=" + dbFileName + ";Version=3;"); m_dbConn.Open(); } catch (SQLiteException ex) { MessageBox.Show("Error: " + ex.Message); } Form2 example2 = new Form2(); if (!example2.cost) { example2.ShowDialog(); this.Show(); } if (File.Exists("this_comp.txt")) { FileStream file1 = new FileStream("this_comp.txt", FileMode.Open); StreamReader reader = new StreamReader(file1); string id = (reader.ReadToEnd()); reader.Close(); if (id != "") { splitContainer2.Enabled = false; } else { string sqlQuery = "select * from distantions"; SQLiteCommand command = new SQLiteCommand(sqlQuery, m_dbConn); SQLiteDataReader dist = command.ExecuteReader(); while (dist.Read()) { distantion categ = new distantion(); categ.id = dist["id"].ToString(); categ.name = dist["title"].ToString(); categ.rounds_col = Convert.ToInt32(dist["rounds_col"]); comboBox1.ValueMember = "id"; comboBox1.DisplayMember = "name"; comboBox1.Items.Add(categ); } comboBox1.ValueMember = "id"; comboBox1.DisplayMember = "name"; comboBox1.SelectedItem = comboBox3.Items[0]; } } competition_list(); }
private void server_Click(object sender, EventArgs e) { child = new Form2(ip.Text, port.Text); child.ShowDialog(); }