private void AddTreatment_Load(object sender, EventArgs e) { DbKindTreatments db = new DbKindTreatments(); DataSet ds = db.GetAllKindTreatments(); DataSet ds2 = ds.Clone(); dataGridView1.DataSource = ds.Tables[0]; dataGridView1.AllowUserToAddRows = false; dataGridView2.AllowUserToAddRows = false; foreach (DataGridViewColumn col in dataGridView1.Columns) { dataGridView2.Columns.Add((DataGridViewColumn)col.Clone()); } DbClients dbc = new DbClients(); comboBox2.DisplayMember = "ClientId"; comboBox2.ValueMember = "ClientId"; comboBox2.DataSource = dbc.GetAllClients().Tables[0].Columns[0].Table; comboBox3.DisplayMember = "WorkerId"; comboBox3.ValueMember = "WorkerId"; DbWorker dbw = new DbWorker(); comboBox3.DataSource = dbw.GetAllWorkers().Tables[0].Columns[0].Table; comboBox4.DisplayMember = "ProductCode"; comboBox4.ValueMember = "ProductCode"; DbCars dbca = new DbCars(); comboBox4.DataSource = dbca.GetAllCars().Tables[0].Columns[0].Table; textBox9.Text = "0"; }
private void button1_Click_1(object sender, EventArgs e) { DbClients db = new DbClients(); dataGridView1.DataSource = db.GetAllClients().Tables[0]; }