Пример #1
0
        private void автомобилиToolStripMenuItem_Click(object sender, EventArgs e)
        {
            car newForm = new car();

            newForm.Owner = this;
            newForm.Show();
        }
Пример #2
0
        private void button1_Click(object sender, EventArgs e)
        {
            car main = this.Owner as car;

            if (main != null)
            {
                for (int i = 0; i < main.dataGridView1.RowCount; i++)
                {
                    main.dataGridView1.Rows[1].Selected = false;
                    for (int j = 0; j < main.dataGridView1.ColumnCount; j++)
                    {
                        if (main.dataGridView1.Rows[i].Cells[j].Value != null)
                        {
                            if (main.dataGridView1.Rows[i].Cells[j].Value.ToString().Contains(tbstr.Text))
                            {
                                main.dataGridView1.Rows[i].Selected = true;
                                break;
                            }
                        }
                    }
                }
            }
        }
Пример #3
0
        private void button1_Click(object sender, EventArgs e)
        {
            Debug.Assert(Owner != null, nameof(Owner) + " != null");
            car main = Owner as car;

            if (main != null)
            {
                DataRow nRow = main.autoDataSet3.Tables[0].NewRow();

                nRow[0] = tbn.Text;
                nRow[1] = tbr.Text;
                nRow[2] = tby.Text;
                nRow[3] = tbinn.Text;

                main.autoDataSet3.Tables[0].Rows.Add(nRow);
                main.carTableAdapter.Update(main.autoDataSet3.car);
                main.autoDataSet3.Tables[0].AcceptChanges();
                main.dataGridView1.Refresh();
                tbn.Text   = "";
                tbr.Text   = "";
                tby.Text   = "";
                tbinn.Text = "";
            }
        }