private void KaydetBtn_Click(object sender, EventArgs e) { DüzenleFrm dfrm = this; this.duzen.adi = MalzemeTxt.Text; this.duzen.ozellik = TipTxt.Text; int result = 0; if (int.TryParse(dfrm.MiktarTxt.Text, out result)) { this.duzen.miktar = result; } this.duzen.teslimAlan = TeslimAlanTxt.Text; this.duzen.teslimEden = TeslimEdenTxt.Text; this.DialogResult = System.Windows.Forms.DialogResult.OK; //ds.WriteXml(Application.StartupPath + "//" + "veri.xml", XmlWriteMode.WriteSchema); //this.Tiklandi = 1; }
private void DüzenleBtn_Click(object sender, EventArgs e) { if (dataGridView1.CurrentRow != null) { DüzenleFrm frm = new DüzenleFrm(); frm.duzen = new Malzeme(); frm.duzen.adi = this.dataGridView1.CurrentRow.Cells[0].Value.ToString(); frm.duzen.ozellik = this.dataGridView1.CurrentRow.Cells[1].Value.ToString(); frm.duzen.miktar = Convert.ToInt32(this.dataGridView1.CurrentRow.Cells[2].Value); frm.duzen.teslimAlan = this.dataGridView1.CurrentRow.Cells[3].Value.ToString(); frm.duzen.teslimEden = this.dataGridView1.CurrentRow.Cells[4].Value.ToString(); DialogResult secim = frm.ShowDialog(); if (secim == System.Windows.Forms.DialogResult.OK) { DataRow dr = (this.dataGridView1.CurrentRow.DataBoundItem as DataRowView).Row; dr[0] = frm.duzen.adi; dr[1] = frm.duzen.ozellik; dr[2] = frm.duzen.miktar; dr[3] = frm.duzen.teslimAlan; dr[4] = frm.duzen.teslimEden; } } else { MessageBox.Show("Düzenlenecek Satırı Seçin"); } }
private void DüzenleFrm_Load(object sender, EventArgs e) { if (this.duzen != null) { DüzenleFrm dfrm = this; this.MalzemeTxt.Text = this.duzen.adi; this.TipTxt.Text = this.duzen.ozellik; int result = 0; if (int.TryParse(dfrm.MiktarTxt.Text, out result)) { this.duzen.miktar = this.duzen.miktar; result.ToString(); } this.TeslimAlanTxt.Text = this.duzen.teslimAlan; this.TeslimEdenTxt.Text = this.duzen.teslimEden; } }