Results 1 to 2 of 2

Thread: Object backcolor problem

  1. #1

    Thread Starter
    New Member
    Join Date
    Sep 2011
    Posts
    15

    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

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    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.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width