コード例 #1
0
 private void buttonEnota_Click(object sender, EventArgs e)
 {
     try
     {
         Ime tempIme = new Ime();
         tempIme.ShowDialog();
         if (tempIme.DialogResult == DialogResult.OK)
         {
             if (tempIme.textBoxIme.Text != "")
             {
                 SQLiteConnection conn = new SQLiteConnection("data source = database.db");
                 conn.Open();
                 SQLiteCommand com = new SQLiteCommand(conn);
                 com.CommandText = "INSERT INTO enote(ime) VALUES('" + tempIme.textBoxIme.Text + "');";
                 com.ExecuteNonQuery();
                 com.Dispose();
                 conn.Close();
                 fresh();
             }
             else
             {
                 MessageBox.Show("Vpisite ime!");
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
コード例 #2
0
 private void addNormbutton_Click(object sender, EventArgs e)
 {
     try
     {
         Ime tempIme = new Ime();
         tempIme.ShowDialog();
         if (tempIme.DialogResult == DialogResult.OK)
         {
             comboBox1.Text  = tempIme.textBoxIme.Text;
             trenutniIzdelek = new Item(tempIme.textBoxIme.Text);
             listBox1.Items.Clear();
             dodajanje = true;
             sestavina = true;
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }