|
-
Nov 17th, 2011, 11:19 PM
#1
Thread Starter
New Member
Object backcolor problem
Hello guys,
I am coding an application for seats reservation and it contains two forms one of the forms contain 32 labels that represent the seat number and when the user wants to reserve that seat, he/she can double click that label to bring up the other form . The other form contains 2 text boxes (Name,Phone) and Date time picker, and I have remove and save. The remove button should change the backcolor of the label that was double clicked in the first form to white. The save button should change the backcolor of the label that was clicked in the first form to yellow. Yes I am using an array.
My question is how can do the two changes, one for the remove button and one for the save button. And I want it to change just the label that was double clicked.
Thank you guys
-
Nov 17th, 2011, 11:56 PM
#2
Re: Object backcolor problem
You would use a single event handler for the MouseDoubleClick event of all Labels. You can do that by selecting them all in the designer, opening the Properties window, clicking the Events button and then double-clicking the desired event. When the event handler is executed, use the 'sender' parameter to get a reference to the label that was double-clicked.
In the event handler, call ShowDialog on your second form and then test its result. You could use Yes for Save to change to one colour and No for Remove to change to the other colour. In your second form, simply set the DialogResult property of the two Buttons to those values and then, when the user clicks one, the form will close and ShowDialog will return that value.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|