Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Windows.Forms;
- using System.IO;
- namespace Exam_System
- {
- public partial class frmQdesign : Form
- {
- public frmQdesign()
- {
- InitializeComponent();
- }
- private void frmQdesign_FormClosing(object sender, FormClosingEventArgs e)
- {
- Application.Exit();
- }
- private void btnExit_Click(object sender, EventArgs e)
- {
- Application.Exit();
- }
- private void btnAdd_Click(object sender, EventArgs e)
- {
- string sFname = txtFname.Text;
- string sQ = txtQ.Text;
- string sA1 = txtA1.Text;
- string sA2 = txtA2.Text;
- string sA3 = txtA3.Text;
- string sA4 = txtA4.Text;
- string sCA = txtCA.Text;
- string sQuestion = "\nN#" + sQ + "#" + sA1 + "#" + sA2 + "#" + sA3 + "#" + sA4 + "#" + sCA;
- if (File.Exists (sFname ))
- {
- using (StreamWriter sw = new StreamWriter(sFname,true ))
- {
- sw.WriteLine(sQuestion );
- }
- }
- else
- {
- MessageBox.Show("Invalid File");
- txtFname.SelectAll();
- txtFname.Focus();
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement