private void Show_Combobox(int iRowIndex, int iColumnIndex) { // DESCRIPTION: SHOW THE COMBO BOX IN THE SELECTED CELL OF THE GRID. // PARAMETERS: iRowIndex - THE ROW ID OF THE GRID. // iColumnIndex - THE COLUMN ID OF THE GRID. int x = 0; int y = 0; int Width = 0; int height = 0; // GET THE ACTIVE CELL'S DIMENTIONS TO BIND THE COMBOBOX WITH IT. Rectangle rect = default(Rectangle); rect = grid_Master.GetCellDisplayRectangle(iColumnIndex, iRowIndex, false); x = rect.X + grid_Master.Left; y = rect.Y + grid_Master.Top; Width = rect.Width; height = rect.Height; ComboBox1.SetBounds(x, y, Width, height); ComboBox1.Visible = true; ComboBox1.Focus(); }
private void ComboBox1_Leave(object sender, EventArgs e) { if (ComboBox1.Text.Length <= 4) { Ep.SetError(ComboBox1, "Type the File Name First..." + "Name Should Be More Than 5 Characters"); ComboBox1.Focus(); ComboBox1.Text = ""; return; } string l = ComboBox1.Text.Substring(0, 4).ToString(); if ((l == "PRJ_") || (l == "prj_") || (l == "Prj_")) { ComboBox1.Text = "Prj_" + (ComboBox1.Text.ToUpper().Substring(4)); Ep.Clear(); return; } else { ComboBox1.Text = "Prj_" + ComboBox1.Text.ToUpper(); Ep.Clear(); } }
private void Button1_Click(object sender, EventArgs e) { clear(); ComboBox1.Enabled = true; Button2.Enabled = true; Button5.Enabled = false; Button6.Enabled = false; TextBox1.Enabled = true; TextBox2.Enabled = true; ComboBox1.Enabled = true; ComboBox1.Focus(); }
private void ComboBox1_Leave(object sender, EventArgs e) { try { if (ComboBox1.Text == "") { Erp.SetError(ComboBox1, "Type the File Name First..." + "Name Should Be More Than 5 Characters"); return; } if (ComboBox1.Text.Length <= 4) { Erp.SetError(ComboBox1, "Type the File Name First..." + "Name Should Be More Than 5 Characters"); ComboBox1.Focus(); ComboBox1.Text = ""; return; } Common.FormatCombo(ComboBox1); if (ComboBox1.Text.Length > 4) { switch ((ComboBox1.Text.Substring(0, 4))) { case "ENG_": ComboBox1.Text = "eng_" + (ComboBox1.Text.Substring(4)).ToLower(); Erp.Clear(); break; case "Eng_": ComboBox1.Text = "eng_" + (ComboBox1.Text.Substring(4)).ToLower(); Erp.Clear(); break; case "eng_": ComboBox1.Text = "eng_" + (ComboBox1.Text.Substring(4)).ToLower(); Erp.Clear(); break; default: ComboBox1.Text = "eng_" + ComboBox1.Text.ToLower(); Erp.Clear(); break; } } } catch (Exception ex) { MessageBox.Show("ComboBox1_Leave @ " + ex.Message); } }
protected void Page_Load(object sender, EventArgs e) { ComboBox1.Focus(); string name; name = System.Security.Principal. WindowsIdentity.GetCurrent().Name.ToString(); Session["name"] = name; string sessionPassword = (string)Session["Password"]; //if (sessionPassword != "Holy1112!") //{ // Response.Redirect("ErrorPage.aspx"); //} }
private void RichTextBox1_KeyPress(object sender, KeyPressEventArgs e) { Point LocationCombo = new Point(); if (e.KeyChar == (char)'<') { LocationCombo = RichTextBox1.GetPositionFromCharIndex(RichTextBox1.SelectionStart); LocationCombo.Y = LocationCombo.Y + RichTextBox1.Font.Height + 3; ComboBox1.Location = LocationCombo; ComboBox1.Visible = true; ComboBox1.DroppedDown = true; ComboBox1.Focus(); } }
private void Button2_Click(object sender, EventArgs e) { ComboBox1.Text = ""; flg_New = true; ComboBox1.Focus(); }
private void Button3_Click(object sender, EventArgs e) { try { int X = 0; if (ComboBox1.Text == "") { Ep.SetError(ComboBox1, "please select/Enter fileName....."); ComboBox1.Focus(); return; } if (ComboBox2.Text == "") { Ep.SetError(ComboBox2, "please select Engine File....."); ComboBox2.Focus(); return; } if (ComboBox3.Text == "") { Ep.SetError(ComboBox3, "please select Sequence File....."); ComboBox3.Focus(); return; } if (ComboBox4.Text == "") { Ep.SetError(ComboBox4, "please select Limit File....."); ComboBox4.Focus(); return; } if (ComboBox5.Text == "") { Ep.SetError(ComboBox5, "please select Correction Standard....."); ComboBox5.Focus(); return; } if (ComboBox6.Text == "") { Ep.SetError(ComboBox6, "please Test Type Standard....."); ComboBox6.Focus(); return; } for (X = 1; X < (DGPrj.RowCount); X++) { if (DGPrj[1, X].Value == null) { Ep.SetError(DGPrj, "please Enter the Value ....."); DGPrj.Focus(); return; } else { Ep.Clear(); } } Format_Cells(); X = 0; flg_New = true; while (X < PrjGV.RowCount - 1) { if (ComboBox1.Text == PrjGV[0, X].Value.ToString()) { flg_New = false; Rw = PrjGV.CurrentRow.Index; break; } else { flg_New = true; } X++; } Rw = PrjGV.CurrentRow.Index; if (flg_New == false) { Global.Open_Connection("gen_db", "con"); MySqlCommand cmd = new MySqlCommand(); cmd.CommandText = "UPDATE tblProject SET " + " EngFile = '" + ComboBox2.Text + "'," + " ProgFile = '" + ComboBox3.Text + "'," + " LimitFile = '" + ComboBox4.Text + "'," + " CorrFile = '" + ComboBox5.Text + "'," + " Test_Type = '" + ComboBox6.Text + "'," + " R_power = '" + DGPrj[1, 0].Value.ToString() + "'," + " R_rpm = '" + DGPrj[1, 1].Value.ToString() + "'," + " MT_Torque = '" + DGPrj[1, 2].Value.ToString() + "'," + " MT_rpm = '" + DGPrj[1, 3].Value.ToString() + "'," + " Fly_rpm = '" + DGPrj[1, 4].Value.ToString() + "'," + " Idle_rpm = '" + DGPrj[1, 5].Value.ToString() + "'," + " E_Strpm = '" + DGPrj[1, 6].Value.ToString() + "'," + " T_Crank = '" + DGPrj[1, 7].Value.ToString() + "'," + " C_Time = '" + DGPrj[1, 8].Value.ToString() + "'," + " PM_Log = '" + DGPrj[1, 9].Value.ToString() + "'" + " WHERE ProjectFile = '" + ComboBox1.Text + "'"; cmd.Connection = Global.con; cmd.ExecuteNonQuery(); Load_DataGrid(); MessageBox.Show("File Updated ....."); } else if (flg_New == true) { Global.Open_Connection("gen_db", "con"); MySqlCommand cmd = new MySqlCommand(); cmd.CommandText = "INSERT INTO tblProject VALUES ('" + ComboBox1.Text + "','" + ComboBox2.Text + "','" + ComboBox3.Text + "','" + ComboBox4.Text + "','" + ComboBox5.Text + "','" + ComboBox6.Text + "','" + DGPrj[1, 0].Value + "','" + DGPrj[1, 1].Value + "','" + DGPrj[1, 2].Value + "','" + DGPrj[1, 3].Value + "','" + DGPrj[1, 4].Value + "','" + DGPrj[1, 5].Value + "','" + DGPrj[1, 6].Value + "','" + DGPrj[1, 7].Value + "','" + DGPrj[1, 8].Value + "','" + DGPrj[1, 9].Value + "')"; cmd.Connection = Global.con; cmd.ExecuteNonQuery(); Load_DataGrid(); MessageBox.Show("File Saved ....."); } } catch (Exception ex) { Global.Create_OnLog(ex.Message + " : File Save....", "Alart"); //MessageBox.Show("Error Code:- 11004" + ex.Message ); } }
private void mnuNew_Click(object sender, EventArgs e) { ComboBox1.Text = ""; ComboBox1.Focus(); flg_New = true; }