public frmTick CreateTickForm(string pid) { for (short i = 0; i < 50; i++) { if (!m_TickForms.ContainsKey(i)) { frmTick tick = new frmTick(i, pid); m_TickForms.Add(i, tick); return(tick); } } Utility.Log(this, "TickFormErr", "Tick Form > 50"); return(null); }
private void BtnSub_Click(object sender, EventArgs e) { try { bool flag = false; OleDbConnection conobj = new OleDbConnection(constr); eventID = Convert.ToInt32(txtEventID.Text); String sqlstr = "SELECT EventID FROM Events WHERE EventID = " + eventID; OleDbCommand command = new OleDbCommand(); command.Connection = conobj; command.CommandText = sqlstr; conobj.Open(); OleDbDataReader reader = command.ExecuteReader(); while (reader.Read()) { if (Convert.ToInt32(reader["EventID"]) == eventID) { flag = true; } else { flag = false; } } conobj.Close(); if (flag) { frmTick tickobj = new frmTick(); Hide(); tickobj.Show(); } else { MessageBox.Show("Event does not exist"); } } catch (IndexOutOfRangeException exc) { MessageBox.Show("Not valid ID"); } catch (Exception exc) { MessageBox.Show("Please enter the Event ID"); } }