private void buttonAddDir_Click(object sender, EventArgs e) { DatabaseWorks database = new DatabaseWorks(Credentials); switch (tabControlDir.SelectedIndex) { case 0: listBoxMainLog.Items.Add(database.AddPhonesData(textBoxDirPhoneType.Text, textBoxDirPhoneNum.Text)); break; case 1: listBoxMainLog.Items.Add(database.AddLocaleType(textBoxDirLocaleType.Text)); break; case 2: listBoxMainLog.Items.Add(database.AddConstructType(textBoxDirConstructType.Text)); break; case 3: listBoxMainLog.Items.Add(database.AddEventType(textBoxDirEventType.Text)); break; } database.Dispose(); DirTabUpdate(); ComboUpdates(); }