Пример #1
0
 private void toolStripModify_Click(object sender, EventArgs e)
 {
     if (dataGridDB.SelectedRows.Count == 1)
     {
         DataGridViewRow row = dataGridDB.SelectedRows[0];
         int             carID = 0, listID = 0;
         try
         {
             listID = Int32.Parse(row.Cells[11].Value.ToString());
             carID  = Int32.Parse(row.Cells[10].Value.ToString());
         }
         catch (Exception ex)
         {
             Console.WriteLine("ERROR: " + ex.Message);
         }
         ModifyPage mp = new ModifyPage("Editing \"" + row.Cells[0].Value.ToString() + "\"", listID);
         mp.Controls["textBoxCost"].Text    = row.Cells[3].Value.ToString();
         mp.Controls["textBoxMileage"].Text = row.Cells[4].Value.ToString();
         mp.Controls["textBoxListing"].Text = row.Cells[0].Value.ToString();
         ComboBox cbCity = (ComboBox)mp.Controls["comboBoxCity"];
         cbCity.SelectedItem = row.Cells[6].Value.ToString();
         ListBox lbCar = (ListBox)mp.Controls["listBoxCars"];
         lbCar.SelectedIndex = findCarIndex(lbCar, carID);
         mp.ShowDialog();
         buttonList_Click(sender, e);
     }
 }
Пример #2
0
        private void toolStripAdd_Click(object sender, EventArgs e)
        {
            ModifyPage mp = new ModifyPage();

            mp.ShowDialog();
            buttonList_Click(sender, e);
        }