예제 #1
0
        public void   sort(DataView dataView)
        {
            MyNotebook form = new MyNotebook();

            dataView.Sort        = "Surname";
            form.dgv1.DataSource = dataView;
        }
예제 #2
0
        private void button1_Click(object sender, EventArgs e)
        {
            WorkWithDataBase notebook = new WorkWithDataBase();
            MyNotebook       form     = new MyNotebook();

            dataView = new DataView(form.AuthorsDataSet.Tables["notebook"]);
            string fileName = "notebook.xml";

            notebook.AddNewDataRowView(dataView);
        }
예제 #3
0
        public void addSave(DataView dataView, string fileName)
        {
            XmlWriter xmlFileW;

            xmlFileW = XmlWriter.Create(fileName);
            dataView.ToTable("notebook");
            MyNotebook form = new MyNotebook();

            form.AuthorsDataSet.WriteXml(xmlFileW);
            xmlFileW.Close();
        }
예제 #4
0
        public void filter(DataView dataView, string finding)
        {
            MyNotebook form = new MyNotebook();


            //dataView.RowFilter = "Surname like '%" + form.textBox2.Text + "%'";
            form.dgv1.Dispose();
            dataView.RowFilter   = "Surname like '" + form.textBox2.Text + "%'";
            form.dgv1.DataSource = dataView;
            form.dgv1.DataSource = dataView;
        }
예제 #5
0
        public void deleterow(DataView dataView, int currentRow)
        {
            string textofcurrentRow = dataView[currentRow]["recordName"].ToString();

            if (MessageBox.Show("Would you like to delete person " + textofcurrentRow, "form closing", MessageBoxButtons.YesNo) == DialogResult.Yes)
            {
                dataView.Delete(currentRow);
                MyNotebook form = new MyNotebook();
                form.dgv1.DataSource = dataView;
            }
        }
예제 #6
0
        public void AddNewDataRowView(DataView dataView)
        {
            DataRowView rowView = dataView.AddNew();

            // Change values in the DataRow.
            ForAddRow additionalform = new ForAddRow();

            rowView["Name"]        = additionalform.txbName.Text;
            rowView["Surname"]     = additionalform.txbSurName.Text;
            rowView["City"]        = additionalform.txbCity.Text;
            rowView["PhoneNumber"] = additionalform.txbPhone.Text;
            rowView["BirhDate"]    = additionalform.txbBirth.Text;
            rowView.EndEdit();
            MyNotebook form = new MyNotebook();

            form.dgv1.DataSource = rowView;
        }
예제 #7
0
        public void find(string propertyForFind, DataView dataView)
        {
            dataView.Sort = "recordName";
            int index = dataView.Find(propertyForFind);

            if (index == -1)
            {
                MessageBox.Show("Nothing was found");
            }
            else
            {
                MyNotebook form = new MyNotebook();
                //  form.dgv1.ClearSelection();
                //form.dgv1.Rows[index].Selected = true;
                MessageBox.Show(dataView[index]["recordName"].ToString() + " " + dataView[index]["Surname"].ToString() + " " + dataView[index]["City"].ToString() + " " + dataView[index]["PhoneNumber"].ToString());
            }
        }