TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Kevin
NA
10
7.1k
code help
Feb 3 2012 7:34 PM
How would I call the Check ID in the add studentbutton every time I call the checkID inside the student button it displays both the student id is already taken and it says student is saved.
private void addStudentButton_Click(object sender, EventArgs e)
{
if (firstNameAddTextBox.Text == string.Empty ||
lastNameAddTextBox.Text == string.Empty ||
idAddTextBox.Text == string.Empty)
{
System.Windows.Forms.MessageBox.Show("Please enter all required information");
}
else
{
Student temp = new Student(this.firstNameAddTextBox.Text,
this.lastNameAddTextBox.Text, this.dobAddTextBox.Value,
Convert.ToInt32(this.idAddTextBox.Text));
data.AddStudent(temp);
checkId();
System.Windows.Forms.MessageBox.Show("Your student has been stored");
}
}
public void checkId()
{
foreach (Student stu in students)
{
if (stu.IdNumber.ToString().Equals(idAddTextBox.Text))
{
MessageBox.Show("Sorry.Student id already in use");
return;
}
}
}
Reply
Answers (
1
)
HOW CAN I DO THAT
Inset,Update,Delete data from the data Grid view