Entry Forms ,Admission Form:
#1

Entry Forms
Admission Form:


Code:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Data.OleDb;
namespace SchoolManagementSystem
{
    public partial class AdmisssionForm : Form
    {
        
        OleDbConnection con = new OleDbConnection(ConnectionStringForSMS.MyConnectionString());
        int classid;
        int classidadmi;
        public string sectionid,abc123;
        public AdmisssionForm()
        {
            InitializeComponent();
          
        }


        private void AdmisssionForm_Load(object sender, EventArgs e)
        {
            try
            {
                OleDbDataAdapter da23 = new OleDbDataAdapter("select schooltitle,Address from schooltitle", con);
                DataSet ds23 = new DataSet();
                da23.Fill(ds23);
                string schooltitle = ds23.Tables[0].Rows[0].ItemArray[0].ToString();
                string address = ds23.Tables[0].Rows[0].ItemArray[1].ToString();
                this.Text = schooltitle + "-Admission Entry";
                label20.Text = "";
                label20.Text = schooltitle;
                DateTime dateofbirth = dateTimePicker1.Value.Date;
                txtboxage.Text = (System.DateTime.Today.Date.Year - dateofbirth.Date.Year).ToString();
              
                OleDbDataAdapter dacategory = new OleDbDataAdapter("Select Category from category", con);
                DataSet dscategory = new DataSet();
                dacategory.Fill(dscategory);
                cmbcategory.DataSource = dscategory.Tables[0];
                cmbcategory.DisplayMember = "category";
                cmbcategory.ValueMember = "category";
                cmbgender.SelectedIndex = 0;
                cmbmedium.SelectedIndex = 0;
                cmbcategory.SelectedIndex = 0;
                txtadminno.Focus();
            }

            catch (Exception e1)
            {
                MessageBox.Show(e1.Message);
            }
        }

      
        private void btnsubmit_Click(object sender, EventArgs e)
        {
                            try
                {  if (txtadminno.Text.Trim() != "")
                    {         if (txtboxfirstname.Text.Trim() != "" && txtboxfirstname.Text.Length >= 3)
                                {
                                    if (txtboxlast.Text.Trim() != "")
                                    {
                                        if (txtboxfaname.Text.Trim() != "" && txtboxfaname.Text.Length >= 3)
                                        {
                                            DateTime todaydate= System.DateTime.Today.Date;
                                            DateTime dateofbirth = dateTimePicker1.Value.Date;
                                        if (dateofbirth != todaydate)
                                            {
                                                if(txtOccuPare.Text.Trim()!="")
                                                {
                                                    if(txtMoTog.Text.Trim()!="")
                                                    {
                                                        if(txtReligion.Text.Trim()!="")
                                                        {
                                                if (cmbgender.SelectedIndex != -1)
                                                {
                                                    if (cmbgender.SelectedIndex != 0)
                                                    {
                                                        if (cmbcategory.SelectedIndex != 0)
                                                        {
                                                            if (cmbmedium.SelectedIndex != -1)
                                                            {
                                                                if (cmbmedium.SelectedIndex != 0)
                                                                {
                                                                    if (cmbclass.SelectedIndex != -1 && cmbclass.SelectedIndex!=0)
                                                                    {
                                                                        if (comboBox1.SelectedIndex != -1 && comboBox1.SelectedIndex!=0)
                                                                        {
                                                                            if (maskedTextBox1.Text.Trim() != "  /  /")
                                                                            {
                                                                                if (txtboxadd.Text.Trim() != "" && txtboxadd.Text.Length >= 3)
                                                                                {

                                                                                    if (txtboxfee.Text.Trim() != "" && txtboxfee.Text.Length >= 3 && Convert.ToInt32(txtboxfee.Text) >= 500)
                                                                                    {
                                                                                        if (txtboxnationality.Text.Trim() != "" && txtboxnationality.Text.Length >= 3)
                                                                                        {
                                                                                            if (txtboxpincode.Text.Trim() != "" && txtboxpincode.Text.Length == 6)
                                                                                            {
                                                                                                if (txtboxtelno.Text.Trim() != "" && txtboxtelno.Text.Length >= 10)
                                                                                                {
                                                                                                    
                                                                                                  
                                                                                                        string date = maskedTextBox1.Text;
                                                                                                        DateTime dt;
                                                                                                        string dt1 = DateTime.Now.Year.ToString();
                                                                                                        int d = Convert.ToInt32(dt1);
                                                                                                        string t = date.Substring(6);
                                                                                                        int y = Convert.ToInt32(t.ToString());
                                                                                                        bool isValid = DateTime.TryParse(date, out dt);
                                                                                                        if (!isValid)
                                                                                                        {
                                                                                                            MessageBox.Show("Admission Date is Invalid", "School Management System", MessageBoxButtons.OK, MessageBoxIcon.Information);
                                                                                                            maskedTextBox1.Focus();
                                                                                                        }
                                                                                                        else
                                                                                                        {
                                                                                                                                                                                                                        DateTime admissiondate = Convert.ToDateTime(maskedTextBox1.Text);
                                                                                                            if (admissiondate.Year != dateofbirth.Year && admissiondate.Year > dateofbirth.Year)
                                                                                                            {
                                                                                                            if (radioButton1.Checked == false && radioButton2.Checked == false)
                                                                                                            {
                                                                                                                MessageBox.Show("Please Select Yes/No for Bustravelling", "School Management System", MessageBoxButtons.OK, MessageBoxIcon.Information);
                                                                                                                radioButton1.Focus();
                                                                                                            }
                                                                                                            else if(comboBox3.SelectedIndex==0||comboBox3.SelectedIndex==-1)
                                                                                                            {
                                                                                                                MessageBox.Show("Please Select Admission Class in School", "School Management System", MessageBoxButtons.OK, MessageBoxIcon.Information);
                                                                                                                comboBox3.Focus();
                                                                                                            }
                                                                                                            else if(radioButton3.Checked == false && radioButton4.Checked == false)
                                                                                                            {
                                                                                                                MessageBox.Show("Please Select Yes/No for Whether TC from a Prev School has been produced on Admission?", "School Management System", MessageBoxButtons.OK, MessageBoxIcon.Information);
                                                                                                                radioButton4.Focus();
                                                                                                            }
                                                                                                            else if(radioButton5.Checked == false && radioButton6.Checked == false)
                                                                                                            {
                                                                                                                MessageBox.Show("Please Select Yes/No for Small-Pox?", "School Management System", MessageBoxButtons.OK, MessageBoxIcon.Information);
                                                                                                                radioButton6.Focus();
                                                                                                            }
                                                                                                            else if (radioButton7.Checked == false && radioButton8.Checked == false)
                                                                                                            {
                                                                                                                MessageBox.Show("Please Select Fee-Pay?", "School Management System", MessageBoxButtons.OK, MessageBoxIcon.Information);
                                                                                                                radioButton7.Focus();
                                                                                                            }
                                                                                                            else
                                                                                                            {
                                                                                                                string check;
                                                                                                                if (radioButton1.Checked == true)
                                                                                                                {
                                                                                                                    check = "Yes";

                                                                                                                }
                                                                                                                else
                                                                                                                {
                                                                                                                    check = "No";
                                                                                                                }
                                                                                                                string check2;
                                                                                                                if (radioButton4.Checked == true)
                                                                                                                {
                                                                                                                    check2 = "Yes";

                                                                                                                }
                                                                                                                else
                                                                                                                {
                                                                                                                    check2 = "No";
                                                                                                                }
                                                                                                                string check3;
                                                                                                                if (radioButton6.Checked == true)
                                                                                                                {
                                                                                                                    check3 = "Yes";

                                                                                                                }
                                                                                                                else
                                                                                                                {
                                                                                                                    check3 = "No";
                                                                                                                }

                                                                                                                string check4;
                                                                                                                if (radioButton7.Checked == true)
                                                                                                                {
                                                                                                                    check4 = "Yearly";

                                                                                                                }
                                                                                                                else
                                                                                                                {
                                                                                                                    check4 = "Monthly";
                                                                                                                }

                                                                                                                DialogResult result;
                                                                                                                result = MessageBox.Show("Are you sure the Student is Active or not", "School Mangement System", MessageBoxButtons.YesNo, MessageBoxIcon.Information);
                                                                                                                if (result == System.Windows.Forms.DialogResult.Yes)
                                                                                                                {
                                                                                                                    string check1;
                                                                                                                    if (checkBox1.Checked == true)
                                                                                                                    {
                                                                                                                        check1 = "Yes";

                                                                                                                    }
                                                                                                                    else
                                                                                                                    {
                                                                                                                        check1 = "No";
                                                                                                                    }
                                                                                                                    


                                                                                                                    int n1 = 0;
                                                                                                                    string n = n1.ToString();
                                                                                                                    string admissionno = txtadminno.Text;
                                                                                                                    string admissiondate1 = maskedTextBox1.Text;
                                                                                                                    int c = cmbcategory.SelectedIndex;
                                                                                                                    string firstname = txtboxfirstname.Text;
                                                                                                                    string middlename = txtboxmiddle.Text;
                                                                                                                    string lastname = txtboxlast.Text;                                                                              
                                                                                                                    string dateofbirth1 = dateTimePicker1.Value.Date.ToShortDateString();
                                                                                                                    string address = txtboxadd.Text;
                                                                                                                    string gender = cmbgender.SelectedItem.ToString();
                                                                                                                    string nationality = txtboxnationality.Text;
                                                                                                                    int pincode = Convert.ToInt32(txtboxpincode.Text);
                                                                                                                    string telph = txtboxtelno.Text;
                                                                                                                    int cl = classid;
                                                                                                                    string sec = sectionid;
                                                                                                                    int se = Convert.ToInt32(sec);
                                                                                                                    string fee = txtboxfee.Text;
                                                                                                                    string fathername = txtboxfaname.Text;
                                                                                                                    int age = Convert.ToInt32(System.DateTime.Today.Date.Year - dateofbirth.Date.Year);
                                                                                                                    string medium = cmbmedium.SelectedItem.ToString();
                                                                                                                    int dd = dateTimePicker1.Value.Day;
                                                                                                                    int mm = dateTimePicker1.Value.Month;
                                                                                                                    string studentname = txtboxfirstname.Text + " " + txtboxmiddle.Text + " " + txtboxlast.Text;
                                                                                                                    con.Open();
                                                                                                                    OleDbCommand cmd = new OleDbCommand("insert into admission (AdmissionNo,AdmisssionDate,StudentName,FatherName,Age,ClassID,SectionID,Medium,FirstName,MiddleName,SurName,DateofBirth,Gender,ResidentAddress,Nationality,Pincode,Telphone,CategoryID,Rollno,IsBusTraveller,dd,mm,Active,OccuFather,MotherTongue,Religion,ClassIDOnAdmission,SchoolCome,PreviousTC,SmallPox,PerIdentification)values('" + admissionno + "','" + admissiondate1 + "','" + studentname + "','" + fathername + "'," + age + "," + cl + "," + se + ",'" + medium + "','" + firstname + "','" + middlename + "','" + lastname + "','" + dateofbirth1 + "','" + gender + "','" + address + "','" + nationality + "'," + pincode + ",'" + telph + "'," + c + ",'" + n + "','" + check + "'," + dd + "," + mm + ",'" + check1 + "','"+txtOccuPare.Text+"','"+txtMoTog.Text+"','"+txtReligion.Text+"',"+classidadmi+",'"+txtSchoolClass.Text+"','"+check2+"','"+check3+"','"+txtMole.Text+"')", con);
                                                                                                                    cmd.ExecuteNonQuery();
                                                                                                                    con.Close();
                                                                                                                    con.Open();
                                                                                                                    string rollno = "0";
                                                                                                                    string installment1 = "0";
                                                                                                                    string installment2 = "0";
                                                                                                                    string installment3 = "0";
                                                                                                                    string installment4 = "0";
                                                                                                                    string installment5 = "0";
                                                                                                                    string installment6 = "0";
                                                                                                                    string installment7 = "0";
                                                                                                                    string installment8 = "0";
                                                                                                                    string installment9 = "0";
                                                                                                                    string installment10 = "0";
                                                                                                                    string installment11 = "0";
                                                                                                                    string installment12 = "0";
                                                                                                                    string bal1 = "0";
                                                                                                                    string status = "Not Paid";
                                                                                                                    OleDbCommand cmd1 = new OleDbCommand("insert into Payment(AdmissionNo,RollNo,ClassID,SectionID,Name,FeeDetails,Installment1,Installment2,Installment3,installment4,installment5,installment6,installment7,installment8,installment9,installment10,installment11,installment12,Netpay,Status,Medium,Balance,Active)values('" + admissionno + "','" + rollno + "'," + cl + "," + se + ",'" + studentname + "','" + check4 + "','" + installment1 + "','" + installment2 + "','" + installment3 + "','" + installment4 + "','" + installment5 + "','" + installment6 + "','" + installment7 + "','" + installment8 + "','" + installment9 + "','" + installment10 + "','" + installment11 + "','" + installment12 + "'," + Convert.ToInt32(txtboxfee.Text) + ",'" + status + "','" + cmbmedium.SelectedItem.ToString() + "','" + bal1 + "','" + check1 + "')", con);
                                                                                                                    cmd1.ExecuteNonQuery();
                                                                                                                    MessageBox.Show("Student Profile Successfully Saved", "School Management System", MessageBoxButtons.OK, MessageBoxIcon.Information);

                                                                                                                    txtadminno.Text = "";
                                                                                                                    txtboxadd.Text = "";
                                                                                                                                                                                                                                        txtboxage.Text = (System.DateTime.Today.Date.Year - dateofbirth.Date.Year).ToString();
                                                                                                                    txtboxfaname.Text = "";
                                                                                                                    txtboxfee.Text = "";
                                                                                                                    txtboxfirstname.Text = "";
                                                                                                                    txtboxlast.Text = "";
                                                                                                                    txtboxmiddle.Text = "";
                                                                                                                    txtboxnationality.Text = "";
                                                                                                                    txtboxpincode.Text = "";
                                                                                                                                                                                                                                        txtboxtelno.Text = "";
                                                                                                                    maskedTextBox1.Text = "";
                                                                                                                    cmbcategory.SelectedIndex = 0;
                                                                                                                                                                                                                                        cmbclass.Text = "--Select--";
                                                                                                                 cmbgender.SelectedIndex = 0;
comboBox1.Text = "--Select--";
                                                                                                                    cmbmedium.SelectedIndex = 0;
dateTimePicker1.Text =Convert .ToString(todaydate);
                                                                                                                    txtOccuPare.Text = "";
                                                                                                                    txtMoTog.Text = "";
                                                                                                                    txtMole.Text = "";
                                                                                                                    txtReligion.Text = "";
                                                                                                                    txtSchoolClass.Text = "";
                                                                                                                    comboBox3.SelectedIndex = -1;
                                                                                                                    radioButton1.Checked = false;
                                                                                                                    radioButton2.Checked = false;
                                                                                                                    radioButton3.Checked = false;
                                                                                                                    radioButton4.Checked = false;
                                                                                                                    radioButton5.Checked = false;
                                                                                                                    radioButton6.Checked = false;
                                                                                                                    }
                                                                                                                else
                                                                                                                {
                                                                                                                    MessageBox.Show("Please unckeck the checkbox", "School Management System", MessageBoxButtons.OK, MessageBoxIcon.Information);
                                                                                                                    checkBox1.Focus();
                                                                                                                }

                                                                                                            }

                                                                                                            }
                                                                                                    else
                                                                                                    {
                                                                                                        MessageBox.Show("Date of Birth Must be Lessthan of Admission Date", "School Management System", MessageBoxButtons.OK, MessageBoxIcon.Information);
                                                                                                        dateTimePicker1.Focus();
                                                                                                      
                                                                                                    }

                                                                                                        }

                                                                                                  
                                                                                                }
                                                                                                else
                                                                                                {
                                                                                                    MessageBox.Show("Please Enter Telephoneno and Minimum 10 characters allowed", "School Management System", MessageBoxButtons.OK, MessageBoxIcon.Information);
                                                                                                    txtboxtelno.Focus();
                                                                                                }

                                                                                            }
                                                                                            else
                                                                                            {
                                                                                                MessageBox.Show("Please Enter Pincode and Minimum 6 Number", "School Management System", MessageBoxButtons.OK, MessageBoxIcon.Information);
                                                                                                txtboxpincode.Focus();
                                                                                            }
                                                                                        }
                                                                                        else
                                                                                        {
                                                                                            MessageBox.Show("Please Enter Nationality and Minimum 3 characters allowed", "School Management System", MessageBoxButtons.OK, MessageBoxIcon.Information);
                                                                                            txtboxnationality.Focus();
                                                                                        }
                                                                                    }
                                                                                    else
                                                                                    {
                                                                                        MessageBox.Show("Please Enter FeeParticular and Minimum 500 Rs allowed ", "School Management System", MessageBoxButtons.OK, MessageBoxIcon.Information);
                                                                                        txtboxfee.Focus();
                                                                                    }
                                                                                }
                                                                                else
                                                                                {
                                                                                    MessageBox.Show("Please Enter Address of a Student and Minimum 3 characters allowed", "School Management System", MessageBoxButtons.OK, MessageBoxIcon.Information);
                                                                                    txtboxadd.Focus();
                                                                                }

                                                                            }
                                                                            else
                                                                            {
                                                                                MessageBox.Show("please enter admission date", "School Management System", MessageBoxButtons.OK, MessageBoxIcon.Information);
                                                                                maskedTextBox1.Focus();
                                                                            }
                                                                        }
                                                                        else
                                                                        {
                                                                            MessageBox.Show("Please Select Section", "School Management System", MessageBoxButtons.OK, MessageBoxIcon.Information);
                                                                            comboBox1.Focus();
                                                                        }
                                                                    }
                                                                    else
                                                                    {
                                                                        MessageBox.Show("Please Select Class", "School Management System", MessageBoxButtons.OK, MessageBoxIcon.Information);
                                                                        cmbclass.Focus();
                                                                    }
                                                                }
                                                                else
                                                                {
                                                                    MessageBox.Show("Please Select Medium", "School Management System", MessageBoxButtons.OK, MessageBoxIcon.Information);
                                                                    cmbmedium.Focus();
                                                                }
                                                            }
                                                            else
                                                            {
                                                                MessageBox.Show("Please Select Medium", "School Management System", MessageBoxButtons.OK, MessageBoxIcon.Information);
                                                                cmbmedium.Focus();
                                                            }
                                                        }
                                                        else
                                                        {
                                                            MessageBox.Show("Please Select Category", "School Management System", MessageBoxButtons.OK, MessageBoxIcon.Information);
                                                            cmbcategory.Focus();
                                                        }
                                                    }
                                                    else
                                                    {
                                                        MessageBox.Show("Please Select Gender", "School Management System", MessageBoxButtons.OK, MessageBoxIcon.Information);
                                                        cmbgender.Focus();
                                                    }
                                                }
                                                else
                                                {
                                                    MessageBox.Show("Please Select Gender", "School Management System", MessageBoxButtons.OK, MessageBoxIcon.Information);
                                                    cmbgender.Focus();
                                                }
                                                        }
                                                        else
                                                        {
                                                            MessageBox.Show("Please Enter Religion", "School Management System", MessageBoxButtons.OK, MessageBoxIcon.Information);
                                                            txtReligion.Focus();
                                                        }
                                                         }
                                                        else
                                                        {
                                                            MessageBox.Show("Please Enter Mother Tongue", "School Management System", MessageBoxButtons.OK, MessageBoxIcon.Information);
                                                            txtMoTog.Focus();
                                                        }
                                                     }
                                                        else
                                                        {
                                                            MessageBox.Show("Please Enter Occupition of Parent/Guardian", "School Management System", MessageBoxButtons.OK, MessageBoxIcon.Information);
                                                           txtOccuPare.Focus();
                                                        }
                                            }
                                            else
                                            {
                                                MessageBox.Show("Please Select Date of Birth", "School Management System", MessageBoxButtons.OK, MessageBoxIcon.Information);
                                                dateTimePicker1.Focus();
                                            }
                                        }
                                        else
                                        {
                                            MessageBox.Show("Please Enter Parent/Guardian of a Student and Minimum 3 characters allowed", "School Management System", MessageBoxButtons.OK, MessageBoxIcon.Information);
                                            txtboxfaname.Focus();
                                        }
                                    }
                                    else
                                    {
                                        MessageBox.Show("Please Enter a SurName of a Student", "School Management System", MessageBoxButtons.OK, MessageBoxIcon.Information);
                                        txtboxlast.Focus();
                                    }
                                }
                                else
                                {
                                    MessageBox.Show("Please Enter a FirstName and Minimum 3 characters allowed", "School Management System", MessageBoxButtons.OK, MessageBoxIcon.Information);
                                    txtboxfirstname.Focus();
                                }

                            }
                            
                            
                            
                          else
                            {
                                MessageBox.Show("please enter admission number", "School Management System", MessageBoxButtons.OK, MessageBoxIcon.Information);
                                txtadminno.Focus();
                    }
                }

                catch (Exception e2)
                {
                
                    MessageBox.Show("Admission Number already exist", "School Management System", MessageBoxButtons.OK,MessageBoxIcon.Error);
                    txtadminno.Focus();
                }

                finally
                {
                    con.Close();
                }
        }
        private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
        {
            OleDbDataAdapter da = new OleDbDataAdapter("Select SectionID from [Section] where Medium='" + cmbmedium.SelectedItem.ToString() + "'and [section]='"+comboBox1.SelectedItem.ToString()+"' and ClassID="+classid+"", con);
            DataSet ds = new DataSet();
            da.Fill(ds);
            if (ds.Tables[0].Rows.Count != 0)
            {
                sectionid = ds.Tables[0].Rows[0]["SectionID"].ToString();
            }
            
        }

        private void button2_Click(object sender, EventArgs e)
        {
            try
            {
                txtadminno.Text = "";
                txtboxadd.Text = "";
                DateTime dateofbirth = dateTimePicker1.Value.Date;
                txtboxage.Text = (System.DateTime.Today.Date.Year - dateofbirth.Date.Year).ToString();
                txtboxfaname.Text = "";
                txtboxfee.Text = "";
                txtboxfirstname.Text = "";
                txtboxlast.Text = "";
                txtboxmiddle.Text = "";
                txtboxnationality.Text = "";
                txtboxpincode.Text = "";
                txtboxtelno.Text = "";
                maskedTextBox1.Text = "";
                cmbcategory.SelectedIndex = 0;
                cmbclass.Text = "--Select--";
                cmbgender.SelectedIndex = 0;
                comboBox1.Items.Clear();
                cmbmedium.SelectedIndex = 0;

                DateTime todaydate = System.DateTime.Today.Date;
                dateTimePicker1.Text =Convert.ToString(todaydate );
                txtOccuPare.Text = "";
                txtMoTog.Text = "";
                txtMole.Text = "";
                txtReligion.Text = "";
                txtSchoolClass.Text = "";
                comboBox3.SelectedIndex = -1;
                radioButton1.Checked = false;
                radioButton2.Checked = false;
                radioButton3.Checked = false;
                radioButton4.Checked = false;
                radioButton5.Checked = false;
                radioButton6.Checked = false;
                txtadminno.Focus();
            }

            catch (Exception e4)
            {
                MessageBox.Show(e4.Message);
            }
        }

        private bool nonNumberEntered = false;

        private void txtboxfaname_KeyDown(object sender, KeyEventArgs e)
        {
            nonNumberEntered = false;
            if (e.KeyCode < Keys.A || e.KeyCode > Keys.Z)
            {
                if (e.KeyCode != Keys.Space)
                {
                    if (e.KeyCode != Keys.Back)
                    {
                        
                        nonNumberEntered = true;
                    }
                  
                }

            }
        }


        private void txtboxfaname_KeyPress(object sender, KeyPressEventArgs e)
        {
            if (nonNumberEntered == true)
            {
                e.Handled = true;
            }
        }

        private void txtboxfirstname_KeyPress(object sender, KeyPressEventArgs e)
        {
            if (nonNumberEntered == true)
            {
                e.Handled = true;
            }
        }


        private void txtboxfirstname_KeyDown(object sender, KeyEventArgs e)
        {
            nonNumberEntered = false;
            if (e.KeyCode < Keys.A || e.KeyCode > Keys.Z)
            {
                
                if (e.KeyCode != Keys.Space)
                {
                    if (e.KeyCode != Keys.Back)
                    {
                        
                        nonNumberEntered = true;
                    }
                }

            }
        }


        private void txtboxmiddle_KeyDown(object sender, KeyEventArgs e)
        {
            nonNumberEntered = false;
            if (e.KeyCode < Keys.A || e.KeyCode > Keys.Z)
            {

                if (e.KeyCode != Keys.Back)
                {
                    nonNumberEntered = true;
                }
            }
        }

        private void txtboxlast_KeyPress(object sender, KeyPressEventArgs e)
        {
            if (nonNumberEntered == true)
            {
                e.Handled = true;
            }
        }

        private void txtboxmiddle_KeyPress(object sender, KeyPressEventArgs e)
        {
            if (nonNumberEntered == true)
            {
                e.Handled = true;
            }
        }


        private void txtboxlast_KeyDown(object sender, KeyEventArgs e)
        {
            nonNumberEntered = false;
            if (e.KeyCode < Keys.A || e.KeyCode > Keys.Z)
            {
                
            
                if (e.KeyCode != Keys.Back)
                {
                    nonNumberEntered = true;
                }
            }
        }


        private void txtboxnationality_KeyDown(object sender, KeyEventArgs e)
        {
            nonNumberEntered = false;
            if (e.KeyCode < Keys.A || e.KeyCode > Keys.Z)
            {
              
                    if (e.KeyCode != Keys.Back)
                    {
                        nonNumberEntered = true;
                    }
              
            }
        }


        private void txtboxnationality_KeyPress(object sender, KeyPressEventArgs e)
        {
            if (nonNumberEntered == true)
            {
                                e.Handled = true;
            }
        }


        private void txtboxtelno_KeyDown(object sender, KeyEventArgs e)
        {
            nonNumberEntered = false;
            if (e.KeyCode < Keys.NumPad0 || e.KeyCode > Keys.NumPad9)
            {
                if (e.KeyCode < Keys.D0 || e.KeyCode > Keys.D9)
                {
                    if (e.KeyCode != Keys.Back)
                    {
                        nonNumberEntered = true;
                    }
                }
            }
        }
        private void txtboxtelno_KeyPress(object sender, KeyPressEventArgs e)
        {
            if (nonNumberEntered == true)
            {
                e.Handled = true;
            }
        }


        private void txtboxpincode_KeyPress(object sender, KeyPressEventArgs e)
        {
            if (nonNumberEntered == true)
            {
                e.Handled = true;
            }
        }


        private void txtboxpincode_KeyDown(object sender, KeyEventArgs e)
        {
            nonNumberEntered = false;
            if (e.KeyCode < Keys.NumPad0 || e.KeyCode > Keys.NumPad9)
            {
                if (e.KeyCode < Keys.D0 || e.KeyCode > Keys.D9)
                {
                    if (e.KeyCode != Keys.Back)
                    {
                        nonNumberEntered = true;
                    }
                }
            }

        }


        private void txtboxage_KeyDown(object sender, KeyEventArgs e)
        {
            nonNumberEntered = false;
            if (e.KeyCode < Keys.NumPad0 || e.KeyCode > Keys.NumPad9)
            {
                if (e.KeyCode < Keys.D0 || e.KeyCode > Keys.D9)
                {
                    if (e.KeyCode != Keys.Back)
                    {
                        nonNumberEntered = true;
                    }
                }
                
            }
        }
        private void txtboxage_KeyPress(object sender, KeyPressEventArgs e)
        {
            if (nonNumberEntered == true)
            {
                e.Handled = true;
            }
        }


        private void txtboxfee_KeyDown(object sender, KeyEventArgs e)
        {
            nonNumberEntered = false;
            if (e.KeyCode < Keys.NumPad0 || e.KeyCode > Keys.NumPad9)
            {
                if (e.KeyCode < Keys.D0 || e.KeyCode > Keys.D9)
                {
                    if (e.KeyCode != Keys.Back)
                    {
                        nonNumberEntered = true;
                    }
                }

            }
        }

        private void txtboxfee_KeyPress(object sender, KeyPressEventArgs e)
        {
            if (nonNumberEntered == true)
            {
                e.Handled = true;
            }
        }

        private void txtboxfirstname_Leave(object sender, EventArgs e)
        {
            txtboxfirstname.Text = ConnectionStringForSMS.Capitalize(txtboxfirstname.Text);
        }

        private void txtboxmiddle_Leave(object sender, EventArgs e)
        {
            txtboxmiddle.Text = ConnectionStringForSMS.Capitalize(txtboxmiddle.Text);
        }

        private void txtboxlast_Leave(object sender, EventArgs e)
        {
            txtboxlast.Text = ConnectionStringForSMS.Capitalize(txtboxlast.Text);
        }

        private void txtboxfaname_Leave(object sender, EventArgs e)
        {
            txtboxfaname.Text = ConnectionStringForSMS.Capitalize(txtboxfaname.Text);
        }

        private void txtboxadd_Leave(object sender, EventArgs e)
        {
            txtboxadd.Text = ConnectionStringForSMS.Capitalize(txtboxadd.Text);
        }

        private void txtboxnationality_Leave(object sender, EventArgs e)
        {
            txtboxnationality.Text = ConnectionStringForSMS.Capitalize(txtboxnationality.Text);
        }

        private void btnClose_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        private void cmbmedium_SelectedIndexChanged(object sender, EventArgs e)
        {
            cmbclass.Items.Clear();
            comboBox3.Items.Clear();
            OleDbDataAdapter daclass = new OleDbDataAdapter("select ClassName from Class where Medium='"+cmbmedium.SelectedItem.ToString()+"' ", con);
            DataSet dsclass = new DataSet();
            daclass.Fill(dsclass);
            if (dsclass.Tables[0].Rows.Count != 0)
            {
                cmbclass.DisplayMember = "ClassName";
                cmbclass.Items.Add("--Select--");
                comboBox3.DisplayMember = "ClassName";
                comboBox3.Items.Add("--Select--");
                for (int i = 0; i < dsclass.Tables[0].Rows.Count; i++)
                {

                    cmbclass.Items.Add(dsclass.Tables[0].Rows[i].ItemArray[0].ToString());
                    comboBox3.Items.Add(dsclass.Tables[0].Rows[i].ItemArray[0].ToString());
                }
                cmbclass.SelectedIndex = 0;
                comboBox3.SelectedIndex = 0;
                comboBox1.Items.Clear();
            }          
            


        }

        private void cmbclass_SelectedIndexChanged(object sender, EventArgs e)
        {          
            comboBox1.Items.Clear();
            
            string classname = cmbclass.SelectedItem.ToString();
            OleDbDataAdapter da = new OleDbDataAdapter("SELECT [Section].[Section] FROM (Class INNER JOIN [Section] ON Class.ClassID = [Section].ClassId) WHERE (Class.ClassName ='"+classname+"')and (class.Medium='"+cmbmedium.SelectedItem.ToString()+"')", con);
            DataSet ds = new DataSet();
            da.Fill(ds);
            if (ds.Tables[0].Rows.Count != 0)
            {
                comboBox1.DisplayMember = "Section";
                comboBox1.Items.Add("--Select--");
                for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                {
                    comboBox1.Items.Add(ds.Tables[0].Rows[i].ItemArray[0].ToString());
                }
                comboBox1.SelectedIndex = 0;
                OleDbDataAdapter daclassid = new OleDbDataAdapter("select classid from class where medium='" + cmbmedium.SelectedItem.ToString() + "' and classname='" + classname + "' ", con);
                DataSet dsclassid = new DataSet();
                daclassid.Fill(dsclassid);
                classid = Convert.ToInt32(dsclassid.Tables[0].Rows[0]["classid"].ToString());
            }
                        
        }

        private void dateTimePicker1_ValueChanged(object sender, EventArgs e)
        {
            DateTime dateofbirth = dateTimePicker1.Value.Date;
            txtboxage.Text = (System.DateTime.Today.Date.Year- dateofbirth.Date.Year).ToString();
        }

        private void comboBox3_SelectedIndexChanged(object sender, EventArgs e)
        {
            OleDbDataAdapter daclassid = new OleDbDataAdapter("select classid from class where medium='" + cmbmedium.SelectedItem.ToString() + "' and classname='" + comboBox3.SelectedItem.ToString() + "' ", con);
            DataSet dsclassid = new DataSet();
            daclassid.Fill(dsclassid);
            if (dsclassid.Tables[0].Rows.Count != 0)
            {
                classidadmi = Convert.ToInt32(dsclassid.Tables[0].Rows[0]["classid"].ToString());
            }
        }

        private void button1_Click(object sender, EventArgs e)
        {
            this.Close();
            EntryForm e1 = new EntryForm();
            e1.Show();
        }

        private void pictureBox1_Click(object sender, EventArgs e)
        {
            this.Close();
            EntryForm e1 = new EntryForm();
            e1.Show();
        }

        private void pictureBox2_Click(object sender, EventArgs e)
        {
            this.Close();
            SMSMainForm a = new SMSMainForm();
            a.Show();
        }

    }

}
Reply

Important Note..!

If you are not satisfied with above reply ,..Please

ASK HERE

So that we will collect data for you and will made reply to the request....OR try below "QUICK REPLY" box to add a reply to this page
Popular Searches: admission form msc 2011, www lotarysambad, www lotterysonbad con, admission mahiticha adhikar application form in marathi pdf, up madarsa board admission form, telephone entry systems, documentation forms 11g**uetooth ppt,

[-]
Quick Reply
Message
Type your reply to this message here.

Image Verification
Please enter the text contained within the image into the text box below it. This process is used to prevent automated spam bots.
Image Verification
(case insensitive)

Possibly Related Threads...
Thread Author Replies Views Last Post
  What are steps involved in creating a form in Access? smart paper boy 0 1,230 29-07-2011, 12:15 PM
Last Post: smart paper boy
  Admission Details.cs seminar class 0 1,098 07-05-2011, 02:59 PM
Last Post: seminar class
  Marks Entry Form.cs seminar class 0 1,231 07-05-2011, 02:59 PM
Last Post: seminar class
  Allot Roll No Form: seminar class 0 1,434 07-05-2011, 02:52 PM
Last Post: seminar class

Forum Jump: