private void TC_ProgramingLanguages_SelectedIndexChanged(object sender, EventArgs e) { if (TC_ProgramingLanguages.SelectedIndex != -1) { if (TC_ProgramingLanguages.SelectedTab.Name != "NewProgramingLanguageForm") { TabPage tabPage = TC_ProgramingLanguages.SelectedTab; tabPage.Controls.Add(this.LB_CodeName); tabPage.Controls.Add(this.TXTBOX_Code); tabPage.Controls.Add(this.TXTBOX_CodeDescription); BTN_DeleteProgramingLanguage.Show(); BTN_DeleteCode.Show(); BTN_DeleteCode.Enabled = false; TXTBOX_Code.Enabled = false; TXTBOX_CodeDescription.Enabled = false; LoadCodeSnippetList(-1); GB_AboutSoftware.Size = new Size(149, 219); } else { BTN_DeleteProgramingLanguage.Hide(); BTN_DeleteCode.Hide(); } BTN_SaveChanges.Hide(); BTN_DropChanges.Hide(); LB_CodeName.Enabled = true; } }
private void BTN_SaveChanges_Click(object sender, EventArgs e) { SQLCommand("UPDATE Codes SET code = '" + TXTBOX_Code.Text + "', description = '" + TXTBOX_CodeDescription.Text + "' WHERE id LIKE '" + ((CodeSnippet)LB_CodeName.SelectedItem).Id + "'"); BTN_SaveChanges.Hide(); BTN_DropChanges.Hide(); BTN_DeleteCode.Show(); LB_CodeName.Enabled = true; LoadCodeSnippetList(LB_CodeName.SelectedIndex); }
private void BTN_DropChanges_Click(object sender, EventArgs e) { TXTBOX_Code.Text = ((CodeSnippet)LB_CodeName.SelectedItem).Code; TXTBOX_CodeDescription.Text = ((CodeSnippet)LB_CodeName.SelectedItem).Description; BTN_SaveChanges.Hide(); BTN_DropChanges.Hide(); BTN_DeleteCode.Show(); LB_CodeName.Enabled = true; }
private void BTN_AddProgramingLanguage_Click(object sender, EventArgs e) { SQLCommand("INSERT INTO ProgramingLanguages (name) VALUES('" + TXTBOX_ProgramingLanguageName.Text + "')"); LoadProgramingLanguagesList(TC_ProgramingLanguages.TabPages.Count - 1); TabPage tabPage = TC_ProgramingLanguages.SelectedTab; tabPage.Controls.Add(this.LB_CodeName); tabPage.Controls.Add(this.TXTBOX_Code); tabPage.Controls.Add(this.TXTBOX_CodeDescription); BTN_DeleteProgramingLanguage.Show(); BTN_DeleteCode.Show(); BTN_DeleteCode.Enabled = false; LoadCodeSnippetList(-1); TXTBOX_ProgramingLanguageName.Text = ""; BTN_AddProgramingLanguage.Enabled = false; BTN_DeleteCode.Enabled = false; }
private void TXTBOX_CodeDescription_TextChanged(object sender, EventArgs e) { if (LB_CodeName.SelectedIndex != -1) { try { if (((CodeSnippet)LB_CodeName.SelectedItem).Code != TXTBOX_Code.Text || ((CodeSnippet)LB_CodeName.SelectedItem).Description != TXTBOX_CodeDescription.Text) { BTN_SaveChanges.Show(); BTN_DropChanges.Show(); BTN_DeleteCode.Hide(); LB_CodeName.Enabled = false; } else { BTN_SaveChanges.Hide(); BTN_DropChanges.Hide(); BTN_DeleteCode.Show(); LB_CodeName.Enabled = true; } } catch { } } }