تقييم الموضوع :
  • 0 أصوات - بمعدل 0
  • 1
  • 2
  • 3
  • 4
  • 5
احتاج مساعدة فيتصميم برنامج
#8
PHP كود :
using System;
using System.Windows.Forms;
using System.Data;

namespace 
WindowsFormsApplication1
{
 
   public partial class Form1 Form
    
{
 
       String xmlFilename "MyFile.xml";
 
       DataSet Ds = new DataSet();
 
       private int rowIndex;

 
       public Form1()
 
       {
 
           InitializeComponent();
 
           if (System.IO.File.Exists(xmlFilename))
 
           {
 
               Ds.ReadXml(xmlFilename);
 
               dataGridView1.DataSource Ds.Tables[0];
 
               Ds.Tables[0].TableName "IDPSN";
 
               dataGridView1.SelectionMode DataGridViewSelectionMode.FullRowSelect;
 
               dataGridView1.AllowUserToAddRows false;
 
               dataGridView1.ReadOnly true;
 
           }
 
       }

 
       private void dataGridView1_Click(object senderEventArgs e)
 
       {
 
           rowIndex dataGridView1.CurrentRow.Index;
 
           textBox1.Text dataGridView1.CurrentRow.Cells[0].Value.ToString();
 
           textBox2.Text dataGridView1.CurrentRow.Cells[1].Value.ToString();
 
           textBox3.Text dataGridView1.CurrentRow.Cells[2].Value.ToString();
 
           textBox4.Text dataGridView1.CurrentRow.Cells[3].Value.ToString();
 
           textBox5.Text dataGridView1.CurrentRow.Cells[4].Value.ToString();
 
       }

 
       private void button1_Click(object senderEventArgs e)
 
       {
 
           DataRow r Ds.Tables[0].NewRow();
 
           r[0] = textBox1.Text;
 
           r[1] = textBox2.Text;
 
           r[2] = textBox3.Text;
 
           r[3] = textBox4.Text;
 
           r[4] = textBox5.Text;
 
           Ds.Tables[0].Rows.Add(r);
 
           Ds.WriteXml("MyFile.xml");
 
           MessageBox.Show("تمت الاضافة بنجاح""Add"MessageBoxButtons.OKMessageBoxIcon.Information);
 
       }

 
       private void button2_Click(object senderEventArgs e)
 
       {
 
           if (rowIndex == -1) return;
 
           if (MessageBox.Show("تحديث?""تحديث"MessageBoxButtons.YesNoMessageBoxIcon.Warning) != DialogResult.Yes) return;
 
           DataRow r Ds.Tables["IDPSN"].Rows[rowIndex];
 
           r[0] = textBox1.Text;
 
           r[1] = textBox2.Text;
 
           r[2] = textBox3.Text;
 
           r[3] = textBox4.Text;
 
           r[4] = textBox5.Text;
 
           Ds.WriteXml(xmlFilename);
 
           MessageBox.Show("تمت التحديث بنجاح""Update"MessageBoxButtons.OKMessageBoxIcon.Information);
 
           rowIndex = -1;
 
           dataGridView1.ClearSelection();
 
       }

 
       private void button3_Click(object senderEventArgs e)
 
       {
 
           if (rowIndex == -1) return;
 
           if (MessageBox.Show("حذف?""حذف"MessageBoxButtons.YesNoMessageBoxIcon.Warning) != DialogResult.Yes) return;
 
           Ds.Tables[0].Rows[rowIndex].Delete();
 
           Ds.WriteXml(xmlFilename);
 
           MessageBox.Show("تمت الحذف بنجاح""Delete"MessageBoxButtons.OKMessageBoxIcon.Information);
 
           rowIndex = -1;
 
           dataGridView1.ClearSelection();
 
       }

 
       private void textBox6_TextChanged(object senderEventArgs e)
 
       {
 
           (dataGridView1.DataSource as DataTable).DefaultView.RowFilter string.Format("Mobile='{0}'"textBox6.Text);
 
       }

 
   }

الرد }}}
تم الشكر بواسطة:


الردود في هذا الموضوع
RE: احتاج مساعدة فيتصميم برنامج - بواسطة a.ahmed - 17-10-17, 02:23 PM


التنقل السريع :


يقوم بقرائة الموضوع: بالاضافة الى ( 1 ) ضيف كريم