Example #1
0
        //Add new entry to the database
        private void btn_Add_Click(object sender, EventArgs e)
        {
            string uname = textBox1.Text;
            string useu  = textBox2.Text;
            string dat   = dateTimePicker1.Text;

            //add the image, covert the image into bytes and add as blob in the sql database
            byte[]       imageBt = null;
            FileStream   fs      = new FileStream(textBox8.Text, FileMode.Open, FileAccess.Read);
            BinaryReader b       = new BinaryReader(fs);

            imageBt = b.ReadBytes((int)fs.Length);



            try
            {
                Form_Methods.addData(uname, useu, gender, dat, imageBt);
                MessageBox.Show("Added");
                textBox1.Text = "";
                textBox2.Text = "";
            }
            catch (MySql.Data.MySqlClient.MySqlException ex)
            {
                MessageBox.Show(ex.Message);
            }
            finally
            {
                Form_Methods.close_db();
            }
        }
Example #2
0
 //Loads the table from the database
 private void btn_load_db_Click(object sender, EventArgs e)
 {
     try
     {
         Form_Methods.load_table(dataGridView1);
     }
     catch (MySql.Data.MySqlClient.MySqlException ex)
     {
         MessageBox.Show(ex.Message);
     }
     finally
     {
         Form_Methods.close_db();
     }
 }
Example #3
0
 //textBox1.Text = comboBox1.Text; - obsolete code
 //superseeded by code to get the details from the database when inde is changes
 private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
 {
     try
     {
         Form_Methods.getDataDb(comboBox1.Text, textBox1, textBox2, pictureBox1);
     }
     catch (MySql.Data.MySqlClient.MySqlException ex)
     {
         MessageBox.Show(ex.Message);
     }
     finally
     {
         Form_Methods.close_db();
     }
 }
Example #4
0
        public void AutoComplete_text()
        {
            txt_suggest_db.AutoCompleteMode   = AutoCompleteMode.SuggestAppend;
            txt_suggest_db.AutoCompleteSource = AutoCompleteSource.CustomSource;
            AutoCompleteStringCollection coll = new AutoCompleteStringCollection();

            try
            {
                Form_Methods.fill_auto_suggestions(coll);
            }catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }

            txt_suggest_db.AutoCompleteCustomSource = coll;
        }
Example #5
0
        public frm_MainForm()
        {
            InitializeComponent();

            try
            {
                Form_Methods.Fillcombo(comboBox1);
                Form_Methods.fill_listobox(listBox1);
                timer1.Start();
                AutoComplete_text();
            }
            catch (MySql.Data.MySqlClient.MySqlException ex)
            {
                MessageBox.Show(ex.Message);
            }
            finally
            {
                Form_Methods.close_db();
            }
        }
Example #6
0
 private void btn_directory_Click(object sender, EventArgs e)
 {
     Form_Methods.ListDir(treeView1, path1);
 }
Example #7
0
 //Create new button method
 private void btn_create_btn_Click(object sender, EventArgs e)
 {
     Form_Methods.create_btn(btn);
 }
Example #8
0
 private void btn_read_pdf_Click(object sender, EventArgs e)
 {
     Form_Methods.read_pd_file(richTextBox1);
 }
Example #9
0
 //Create pdfDocument using ITextSharp
 //adding lists to the document
 //adding the database table to the document ( table must be laoded first)
 private void btn_create_pdf_Click(object sender, EventArgs e)
 {
     Form_Methods.createPDFDocument(dataGridView1);
 }
Example #10
0
 //Select image and add to picturebox
 private void btn_select_img_Click(object sender, EventArgs e)
 {
     Form_Methods.addImgPicbox(textBox8, pictureBox1);
 }
Example #11
0
 //Create XLS file
 private void btn_create_excel_Click(object sender, EventArgs e)
 {
     Form_Methods.create_excel_file();
 }
Example #12
0
 //Search the rich text box for entered keywords
 private void btn_search_txt_Click(object sender, EventArgs e)
 {
     Form_Methods.searchRichText(richTextBox1, textBox3);
 }