public void ClearTextBox() { //Limpia los TXTBOX y Limpia la seleccion del listbox AgeTxt.Clear(); LastNametTxt.Clear(); NameTxt.Clear(); PaymentHTxt.Clear(); TotalHoursTxt.Clear(); listBox1.ClearSelected(); }
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; }
private async void Register() { if (string.IsNullOrEmpty(this.EmailTxt)) { await Application.Current.MainPage.DisplayAlert("Error", "You must enter an email", "Accept"); return; } if (string.IsNullOrEmpty(this.PasswordTxt)) { await Application.Current.MainPage.DisplayAlert("Error", "You must enter a Password", "Accept"); return; } if (string.IsNullOrEmpty(this.UsernameTxt)) { await Application.Current.MainPage.DisplayAlert("Error", "You must enter an Username", "Accept"); return; } if (AgeTxt.ToString() == null) { await Application.Current.MainPage.DisplayAlert("Error", "You must enter an Age", "Accept"); return; } if (string.IsNullOrEmpty(this.LNameTxt)) { await Application.Current.MainPage.DisplayAlert("Error", "You must enter an Last Name", "Accept"); return; } if (string.IsNullOrEmpty(this.FNameTxt)) { await Application.Current.MainPage.DisplayAlert("Error", "You must enter an First Name", "Accept"); return; } var user = new User { Email = EmailTxt.ToLower(), Password = PasswordTxt.ToLower(), FirstName = FNameTxt.ToLower(), LastName = LNameTxt.ToLower(), Age = AgeTxt.ToString(), Creation_Date = DateTime.UtcNow.Date }; await App.Database.SaveUserAsync(user);//Anade al nuevo usuario creado en el registro }
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(); }