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
Aaron Soggi
NA
7
609
I want to create a simple seat reservation for my application
Mar 21 2021 12:10 AM
I want to create a simple seat reservation system where the picture box will change to another image once the user has clicked the picture box. If the image is set as "availableSeat" it will turn green. If the user attempts to select another seat with the status "availableSeat" i want the application to throw an error message. "please unmatch your current seat, before selecting another" etc. Below is the codee that I have so far, I've been trying to do this for a while now and I'm honestly lost, the annoying thing is it seems like its a simple fix. I was thinking of making a separate class and monitoring the seat status that way, but i wouldn't even know where to start.
The problem i have is the user is still given an error message even if the user clicks on a picture box that is set as "seatTaken", i simply just want it to change back to "availableSeat". Secondly if the user selects a seat which is set as availablethey still receive an error message which is not what i want.
All picture boxes are part of the same click event. Can anyone help? i'd really really appreciate it
Bitmap availableSeat = Properties.Resources.availableSeatt;
Bitmap seatTaken = Properties.Resources.provisional;
private
void
Button_Click(
object
sender, EventArgs e)
{
var pb = (PictureBox)sender;
if
(n == 1 || pb.Image == seatTaken && n ==1)
{
MessageBox.Show(
"Please unmatch seat"
);
}
if
(pb.Image == availableSeat)
{
pb.Image = seatTaken;
n = 1;
}
else
{
pb.Image = availableSeat;
n = 0;
}
selectedSeatNo = pb.Tag.ToString();
}
Reply
Answers (
1
)
End my session variable while the system makes a shutdown or log off.
c# windows form ATM machine