private void ChinSuaDaiLy_Load(object sender, EventArgs e) { if (dataGridView1.Rows.Count >= 0) { dataGridView1.Rows[0].Selected = true; } SendButton.Hide(); }
/*************************** Game Lobby ************************************** * initializes the lobby and allows only the exit button and the login button the * be available before connecting to the server. */ public gameLobby() { InitializeComponent(); CreateButton.Hide(); ListGamesButton.Hide(); JoinButton.Hide(); SendButton.Hide(); this.AcceptButton = SendButton; } // end of gameLobby
private void EditAgency_Load(object sender, EventArgs e) { portionBindingSource.DataSource = agency.Portions; portionBindingSource.ResetBindings(false); if (dataGridView1.Rows.Count > 0) { dataGridView1.Rows[0].Selected = true; } SendButton.Hide(); }
private void TakeRadioButton_CheckedChanged(object sender, EventArgs e) { if (TakeRadioButton.Checked) { SendButton.Hide(); TakeButton.Show(); SelectFileButton.Hide(); SelectedFileTextBox.Hide(); } SelectedFileTextBox.Clear(); }
private void HideMainComp() { dataGridView1.Hide(); LoggedInfLabel.Hide(); LoggedEmailInf.Hide(); LogoutButton.Hide(); UpdateLabel.Hide(); SubjectLabel.Hide(); SubjectTextB.Hide(); RecipientLabel.Hide(); RecipientTextBox.Hide(); BodyLabel.Hide(); BodyTextBox.Hide(); SendButton.Hide(); MailSaveButton.Hide(); DeserializeButton.Hide(); RefreshButton.Hide(); }
private void SaveAgency_Click(object sender, EventArgs e) { if (agency == null) { agency = new Agency(); } //Check bool flag = true; ValidateItems(NameBox); if (NameBox.Text.Length > 50 || NameBox.Text.Length < 4) { NameBox.BackColor = Color.Red; MessageBox.Show("The Length of name isn't inconsonant. \n The name is belong from 4 to 50 characters", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); NameBox.Text = string.Empty; NameBox.BackColor = Color.White; flag = false; } else { for (int i = 0; i < NameBox.Text.Length; i++) { if (NameBox.Text[i] >= '0' && NameBox.Text[i] <= '9') { NameBox.BackColor = Color.Red; MessageBox.Show("The Name Just Contains Number ??? \n The Name Should be Include Number and Characters", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); NameBox.Text = string.Empty; NameBox.BackColor = Color.White; flag = false; break; } } } agency.Name = NameBox.Text; ValidateItems(DescriptionBox); if (DescriptionBox.Text.Length > 1000 || DescriptionBox.Text.Length < 12) { DescriptionBox.BackColor = Color.Red; MessageBox.Show("The Length of Description isn't inconsonant. \n The Description is belong from 12 to 1000 characters", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); DescriptionBox.BackColor = Color.White; DescriptionBox.Text = string.Empty; } else if (DescriptionBox.Text == null) { DescriptionBox.BackColor = Color.Red; MessageBox.Show("Please Something Into Blank space", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); DescriptionBox.Text = string.Empty; DescriptionBox.BackColor = Color.White; } agency.Description = DescriptionBox.Text; agency.Image = pictureBox1.Image; bool AlreadyExist = false; if (agency.Image == null) { pictureBox1.BackColor = Color.Gray; MessageBox.Show("Have You Choose The Picture ???", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); pictureBox1.BackColor = Color.White; flag = false; } foreach (Agency a in vietTravel.Agencies) { if (a.Name == agency.Name && Odd == false) { AlreadyExist = true; break; } else { AlreadyExist = false; } } if (AlreadyExist == true) { NameBox.BackColor = Color.Red; MessageBox.Show("This Name Already Exist \n Please Try Again With Another Name", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); NameBox.Text = string.Empty; NameBox.BackColor = Color.White; flag = false; } if (agency.Portions.Count == 0) { MessageBox.Show("Please add some trips! It`s impossible to send agency without any trips to the client!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); flag = false; } else { agency.Portions = new List <Portion>(); agency.Portions = (List <Portion>)portionBindingSource.DataSource; foreach (Portion p in agency.Portions) { p.Agency_Name = agency.Name; } agency.Amount = agency.Portions.Count; portionBindingSource.DataSource = agency.Portions; portionBindingSource.ResetBindings(false); } if (agency.Name == "Hendrichs Cullen" || agency.Description == "Victoria City, Melbourne" || agency.Image == null || agency.Portions.Count == 0 || AlreadyExist == true) { flag = false; } if (agency.Name == "Christopher Rohit" || agency.Description == "Stuttgart , Germany" || agency.Image == null || agency.Portions.Count == 0 || AlreadyExist == true) { flag = false; } if (flag == false) { SendButton.Show(); SaveAgency.Hide(); } else { MessageBox.Show("Do you missed something !!!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); SaveAgency.Show(); SendButton.Hide(); } }