Exemple #1
0
        private void btnUpdate_Click(object sender, EventArgs e)
        {
            if (ValidateData())
            {
                WriteToFile  wf = new WriteToFile();
                ReadFromFile rd = new ReadFromFile();
                DataSet      ds = loadDataToDataset();
                if (wf.WriteToTxtFile(ds, path))
                {
                    oMsg.Add("Record Saved");
                    MessageBox.Show(m.oMsgToString(oMsg));

                    ClearForm();
                    DataTable dt      = rd.ReadTxtToDataTable(path + "\\data.txt", 13);
                    DataTable finalDT = rd.ConvertDataSet(dt);
                }
                else
                {
                    oMsg.Add("Submition Failed");
                    MessageBox.Show(m.oMsgToString(oMsg));
                }
            }
            else
            {
                oMsg.Add("Unable to make the submition");
            }
            MessageBox.Show(m.oMsgToString(oMsg));
        }
Exemple #2
0
        private void btSubmit_Click(object sender, EventArgs e)
        {
            if (ValidateData())
            {
                WriteToFile  wf = new WriteToFile();
                ReadFromFile rd = new ReadFromFile();
                DataSet      ds = loadDataToDataset();
                if (wf.WriteToTxtFile(ds, path))
                {
                    oMsg.Add("Record Saved");

                    ClearForm();
                    DataTable dt;
                    dt = rd.ReadTxtToDataTable(path + "\\data.txt", 13);
                    DataTable finalDT = rd.ConvertDataSet(dt);
                    DataView  view    = new DataView(finalDT);
                    dataGridView1.DataSource = view;
                }
                else
                {
                    oMsg.Add("Submition Failed");
                }
            }
            else
            {
                oMsg.Add("Unable to make the submition");
            }

            lbloMsgs.Text = oMsgToString(oMsg);
            oMsg.Clear();
        }