Exemplo n.º 1
0
 public void ClearTextBox()
 {
     //Limpia los TXTBOX y Limpia la seleccion del listbox
     AgeTxt.Clear();
     LastNametTxt.Clear();
     NameTxt.Clear();
     PaymentHTxt.Clear();
     TotalHoursTxt.Clear();
     listBox1.ClearSelected();
 }
Exemplo n.º 2
0
 public void ClearTextBox()
 {
     //Limpia los TXTBOX y Limpia la seleccion del listbox
     AgeTxt.Clear();
     LastNametTxt.Clear();
     NameTxt.Clear();
     PaymentHTxt.Clear();
     TotalHoursTxt.Clear();
     listBox1.ClearSelected();
     pictureBox1.Image      = null;
     TotalHoursTxt.ReadOnly = false;
 }
Exemplo n.º 3
0
        private void SaveBtn_Click(object sender, EventArgs e)
        {
            try
            {
                String name    = NameTxt.Text; /*storing text from textbox into variable to designated datatypes*/
                String address = AddressTxt.Text;
                Int64  contact = Convert.ToInt64(ContactTxt.Text);
                int    age     = Convert.ToInt32(AgeTxt.Text);
                String gender  = comboGender.Text;
                String blood   = BloodTxt.Text;
                String any     = PreProblemTxt.Text;
                int    pid     = Convert.ToInt32(PaitionIdTxt.Text);

                System.Data.SqlClient.SqlConnection con = new System.Data.SqlClient.SqlConnection();
                con.ConnectionString = "data source = DESKTOP-G7R371A\\SQLEXPRESS; database = Hospital; integrated security = True";
                System.Data.SqlClient.SqlCommand cmd = new System.Data.SqlClient.SqlCommand();
                cmd.Connection = con; /*connecting database*/

                cmd.CommandText = "insert into AddPatient values ('" + name + "', '" + address + "'," + contact + "," + age + ",'" + gender + "','" + blood + "','" + any + "'," + pid + ")";

                System.Data.SqlClient.SqlDataAdapter DA = new System.Data.SqlClient.SqlDataAdapter(cmd);
                DataSet DS = new DataSet(); /*Data set to fill boxes*/
                DA.Fill(DS);
                MessageBox.Show("Data Saved!");
            }
            catch (Exception)
            {
                MessageBox.Show("Please fill up all boxes");
            }

            /*Clearing all boxes*/

            NameTxt.Clear();
            AddressTxt.Clear();
            ContactTxt.Clear();
            AgeTxt.Clear();
            BloodTxt.Clear();
            PreProblemTxt.Clear();
            PaitionIdTxt.Clear();
            comboGender.ResetText();
        }